sendinblue / APIv3-typescript-library

SendinBlue's API v3 client
40 stars 19 forks source link

Where can I find the types? #45

Closed quintenb closed 2 years ago

quintenb commented 2 years ago

I have this script... which works just fine.... but all types are :any. It makes it hard to develop. Am I missing a package?

Screenshot 2022-02-18 at 17 27 35


import { NextApiRequest, NextApiResponse } from "next"

const SibApiV3Sdk = require("sib-api-v3-typescript")

export default async (req: NextApiRequest, res: NextApiResponse) => {
  try {
    const { email } = req.query

    let apiInstance = new SibApiV3Sdk.ContactsApi()

    let apiKey = apiInstance.authentications["apiKey"]

    apiKey.apiKey = "XXXXX"

    let createContact = new SibApiV3Sdk.CreateContact()

    createContact.email = email ?? ""
    createContact.listIds = [11]

    const result = await apiInstance.createContact(createContact)

    res.status(200).json({ wtf: "wtf", result })
  } catch (error) {
    res.status(500).json({ error, message: "error" })
  }
}
quintenb commented 2 years ago

I see i mixed up my import.

this worked:

import SibApiV3Sdk from "sib-api-v3-typescript"