UNPKG

omnisend-node-sdk

Version:

🔹 Typesafe Omnisend API SDK for Node.js

117 lines (116 loc) • 3.95 kB
import type { ContactsInput, ContactsOutput, PagingCursor } from "../data-contracts"; import type { HttpClient, RequestParams } from "../http-client"; export declare class Contacts<SecurityDataType = unknown, SafeMode extends true | false = false> { http: HttpClient<SecurityDataType, SafeMode>; constructor(http: HttpClient<SecurityDataType, SafeMode>); /** * @description `contactID` - contact's ID in our system * * @tags Contacts * @name GetContacts * @summary Get contact's info * @request GET:/contacts/{contactID} * @secure */ getContacts: (contactId: string, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: ContactsOutput; } : ContactsOutput>; /** * @description Update existing contact. Pass only fields you want to update. `contactID` - contact's ID in our system You can update contact: * by `contactID` in endpoint path. Example: `PATCH` [https://api.omnisend.com/v3/contacts/696969](https://api.omnisend.com/v3/contacts/696969) **Note:** - You can update any field, except `email` (`identifiers.id` value for type `email`). - `Phone` (`identifiers.id` value for type `phone`) will be added/updated **only** if it isn't assigned to another contact. * * @tags Contacts * @name PatchContactsContactId * @summary Update contact * @request PATCH:/contacts/{contactID} * @secure */ patchContactsContactId: (contactId: string, data: object & ContactsInput, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { /** @format email */ email?: string | undefined; contactID: string; phone?: string | undefined; }; } : { /** @format email */ email?: string | undefined; contactID: string; phone?: string | undefined; }>; /** * No description * * @tags Contacts * @name ListContacts * @summary List contacts * @request GET:/contacts * @secure */ listContacts: (query?: { /** * Full email address. * @format email */ email?: string; /** Email channel status. See endpoint description for available statuses. */ status?: "subscribed" | "unsubscribed" | "nonSubscribed"; /** Segment ID. */ segmentID?: string; tag?: string; /** * Number of results to fetch. Default is 100, max 250. * @min 1 * @max 250 * @default 100 */ limit?: number; phone?: string; }, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { contacts?: ContactsOutput[] | undefined; paging?: PagingCursor | undefined; }; } : { contacts?: ContactsOutput[] | undefined; paging?: PagingCursor | undefined; }>; /** * @description Create new contact. * * @tags Contacts * @name PostContacts * @summary Create contact * @request POST:/contacts * @secure */ postContacts: (data: { /** Send welcome email (will be sent only if welcome workflow is turned on) or not. */ sendWelcomeEmail?: boolean; } & ContactsInput, params?: RequestParams) => Promise<SafeMode extends true ? { success: false; error?: string | undefined; } | { success: true; data: { /** @format email */ email?: string | undefined; contactID: string; }; } : { /** @format email */ email?: string | undefined; contactID: string; }>; }