UNPKG

@trycourier/courier-js

Version:

A browser-safe API wrapper

38 lines (37 loc) 1.44 kB
export type CourierUserPreferencesStatus = 'OPTED_IN' | 'OPTED_OUT' | 'REQUIRED' | 'UNKNOWN'; export type CourierUserPreferencesChannel = 'direct_message' | 'inbox' | 'email' | 'push' | 'sms' | 'webhook' | 'unknown'; export interface CourierUserPreferencesPaging { cursor?: string; more: boolean; } export interface CourierUserPreferencesTopic { topicId: string; topicName: string; sectionId: string; sectionName: string; status: CourierUserPreferencesStatus; defaultStatus: CourierUserPreferencesStatus; hasCustomRouting: boolean; customRouting: CourierUserPreferencesChannel[]; } export interface CourierUserPreferences { items: CourierUserPreferencesTopic[]; paging: CourierUserPreferencesPaging; } export interface CourierUserPreferencesTopicResponse { topic: CourierUserPreferencesTopic; } export declare class PreferenceTransformer { /** * Transforms a single API response item to the CourierUserPreferencesTopic type * @param item - The API response item * @returns A CourierUserPreferencesTopic object */ transformItem(item: any): CourierUserPreferencesTopic; /** * Transforms an array of API response items to CourierUserPreferencesTopic objects * @param items - The API response items * @returns A generator of CourierUserPreferencesTopic objects */ transform(items: any[]): Generator<CourierUserPreferencesTopic>; }