customerio-node
Version:
A node client for the Customer.io event API. http://customer.io
53 lines (52 loc) • 2.13 kB
TypeScript
/// <reference types="node" />
import type { RequestOptions } from 'https';
import Request, { BearerAuth, RequestData } from './request';
import { Region } from './regions';
import { SendEmailRequest, SendPushRequest, SendSMSRequest } from './api/requests';
import { Filter, IdentifierType } from './types';
type APIDefaults = RequestOptions & {
region: Region;
url?: string;
};
type Recipients = Record<string, unknown>;
export declare enum DeliveryExportMetric {
Created = "created",
Attempted = "attempted",
Sent = "sent",
Delivered = "delivered",
Opened = "opened",
Clicked = "clicked",
Converted = "converted",
Bounced = "bounced",
Spammed = "spammed",
Unsubscribed = "unsubscribed",
Dropped = "dropped",
Failed = "failed",
Undeliverable = "undeliverable"
}
export type DeliveryExportRequestOptions = {
start?: number;
end?: number;
attributes?: string[];
metric?: DeliveryExportMetric;
drafts?: boolean;
};
export declare class APIClient {
appKey: BearerAuth;
defaults: APIDefaults;
request: Request;
apiRoot: string;
constructor(appKey: BearerAuth, defaults?: Partial<APIDefaults>);
sendEmail(req: SendEmailRequest): Promise<Record<string, any>>;
sendPush(req: SendPushRequest): Promise<Record<string, any>>;
sendSMS(req: SendSMSRequest): Promise<Record<string, any>>;
getCustomersByEmail(email: string): Promise<Record<string, any>>;
triggerBroadcast(id: string | number, data: RequestData, recipients: Recipients): Promise<Record<string, any>>;
listExports(): Promise<Record<string, any>>;
getExport(id: string | number): Promise<Record<string, any>>;
downloadExport(id: string | number): Promise<Record<string, any>>;
createCustomersExport(filters: Filter): Promise<Record<string, any>>;
createDeliveriesExport(newsletterId: number, options?: DeliveryExportRequestOptions): Promise<Record<string, any>>;
getAttributes(id: string | number, idType?: IdentifierType): Promise<Record<string, any>>;
}
export { SendEmailRequest, SendPushRequest, SendSMSRequest } from './api/requests';