UNPKG

@sinaptik/retein-sdk

Version:

Retein Node.js SDK for event-based email marketing automation.

69 lines (68 loc) 1.98 kB
type SDKOptions = { verbose?: boolean; host?: string; }; interface SessionOptions { ip_address?: string; user_agent?: string; session_id?: string; } interface SessionIdentity { id: string; lastIdentifiedAt: string; contactId: string; createdAt: string; updatedAt: string; userId: string; isBackend: boolean; contact?: any; } interface Session { id: string; identityId: string; referrer: string | null; utmSource: string | null; utmMedium: string | null; utmCampaign: string | null; utmTerm: string | null; utmContent: string | null; userAgent: string | null; device: string | null; os: string | null; utmParamsExtras: any | null; ipAddress: string | null; city: string | null; region: string | null; country: string | null; latitude: number | null; longitude: number | null; createdAt: string; identity?: SessionIdentity; } export declare class ReteinSDK { private public_key; private host; private identityId; private sessionId; private distinctId; private verbose; constructor(public_key: string, options?: SDKOptions); static create(public_key: string, options?: SDKOptions): Promise<ReteinSDK>; private _retrieveSessionId; track(eventName: string, properties?: Record<string, any>): Promise<void>; identify(distinctId: string, options?: SessionOptions): Promise<void>; /** * List the last sessions for a specific identity * * @param distinctId The distinct ID of the user * @param limit Maximum number of sessions to return (between 5-20, default: 5) * @returns Object containing array of session objects */ listLastSessions(distinctId: string, limit?: number): Promise<Session[]>; updateUser(properties: Record<string, any>): Promise<void>; private defaultHeaders; private fetchWithRetry; private log; reset(): void; } export default ReteinSDK;