UNPKG

meta-cloud-api

Version:
162 lines (158 loc) 5.32 kB
import { B as BaseAPI } from './base-CdGDdVEl.js'; import { WabaConfigType } from './types/config.js'; import { a as GeneralRequestBody, e as ResponseSuccess, d as ResponsePagination, R as RequesterClass } from './request-vYMaEfk5.js'; import { L as LanguagesEnum, a as CategoryEnum, T as TemplateStatusEnum } from './enums-BZd9T2ul.js'; type TemplateFormat = 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT' | 'LOCATION' | 'PRODUCT'; type PhoneNumberButton = { type: 'PHONE_NUMBER'; text: string; phone_number: string; }; type URLButton = { type: 'URL'; text: string; url: string; example?: string[]; }; type QuickReplyButton = { type: 'QUICK_REPLY'; text: string; }; type CopyCodeButton = { type: 'COPY_CODE'; example: string; }; type FlowButton = { type: 'FLOW'; text: string; flow_id?: string; flow_name?: string; flow_json?: string; flow_action?: 'navigate' | 'data_exchange'; navigate_screen?: string; }; type MPMButton = { type: 'MPM'; action?: { thumbnail_product_retailer_id: string; sections: Array<{ title?: string; product_items: Array<{ product_retailer_id: string; }>; }>; }; }; type OTPButton = { type: 'OTP'; }; type SPMButton = { type: 'SPM'; action?: { product_retailer_id: string; }; }; type CatalogButton = { type: 'CATALOG'; action?: { thumbnail_product_retailer_id: string; }; }; type TemplateButton = PhoneNumberButton | URLButton | QuickReplyButton | CopyCodeButton | FlowButton | MPMButton | OTPButton | SPMButton | CatalogButton; type TemplateHeaderExample = { header_text?: string[]; header_text_named_params?: Array<{ param_name: string; example: string; }>; header_handle?: string[]; }; type TemplateHeader = { type: 'HEADER'; format: TemplateFormat; text?: string; example?: TemplateHeaderExample; }; type TemplateBody = { type: 'BODY'; text: string; example?: { body_text?: Array<Array<string>>; body_text_named_params?: Array<{ param_name: string; example: string; }>; }; }; type TemplateFooter = { type: 'FOOTER'; text: string; }; type TemplateButtons = { type: 'BUTTONS'; buttons: TemplateButton[]; }; type TemplateLimitedTimeOffer = { type: 'LIMITED_TIME_OFFER'; limited_time_offer: { expiration_time_ms: number; }; }; type TemplateCarousel = { type: 'CAROUSEL'; cards: Array<{ card_index: number; components: ComponentTypes[]; }>; }; type MediaCarouselCard = { card_index: number; components: (TemplateHeader | TemplateBody | TemplateButtons)[]; }; type ProductCarouselCard = { card_index: number; components: TemplateHeader[]; }; type ComponentTypes = TemplateHeader | TemplateBody | TemplateFooter | TemplateButtons | TemplateLimitedTimeOffer | TemplateCarousel; type TemplateRequestBody = GeneralRequestBody & { name: string; language: LanguagesEnum; category?: CategoryEnum; components?: ComponentTypes[]; }; type TemplateResponse = { id: string; status: string; language: LanguagesEnum; category: CategoryEnum; name: string; components: ComponentTypes[]; }; type TemplateGetParams = { limit?: number; name?: string; language?: LanguagesEnum; category?: CategoryEnum; status?: TemplateStatusEnum; }; type TemplateDeleteParams = { hsm_id: string; name: string; }; declare class TemplateClass { getTemplate(templateId: string): Promise<TemplateResponse>; updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>; getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>; createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>; deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>; } declare class TemplateApi extends BaseAPI implements TemplateClass { private readonly endpoint; constructor(config: WabaConfigType, client: RequesterClass); getTemplate(templateId: string): Promise<TemplateResponse>; updateTemplate(templateId: string, template: Partial<TemplateRequestBody>): Promise<ResponseSuccess>; getTemplates(params?: TemplateGetParams): Promise<ResponsePagination<TemplateResponse>>; createTemplate(template: TemplateRequestBody): Promise<TemplateResponse>; deleteTemplate(params: TemplateDeleteParams): Promise<ResponseSuccess>; } export { type CatalogButton as C, type FlowButton as F, type MPMButton as M, type OTPButton as O, type PhoneNumberButton as P, type QuickReplyButton as Q, type SPMButton as S, TemplateApi as T, type URLButton as U, TemplateClass as a, type TemplateDeleteParams as b, type TemplateGetParams as c, type TemplateRequestBody as d, type TemplateResponse as e, type TemplateFormat as f, type ComponentTypes as g, type CopyCodeButton as h, type TemplateBody as i, type TemplateButton as j, type TemplateButtons as k, type TemplateCarousel as l, type TemplateFooter as m, type TemplateHeader as n, type TemplateHeaderExample as o, type TemplateLimitedTimeOffer as p, type MediaCarouselCard as q, type ProductCarouselCard as r };