meta-cloud-api
Version:
TypeScript wrapper for Meta's Cloud API
84 lines (77 loc) • 5.5 kB
TypeScript
export { W as WebhookContact, a as WebhookEvent, c as WebhookHandler, b as WebhookMessage } from './WebhookHandler-Bxxi6SdT.js';
import { g as FlowEndpointRequest, o as FlowDataExchangeRequest, c as FlowActionEnum, p as FlowErrorNotificationRequest, q as FlowHealthCheckRequest } from './FlowApi-CASVC-Al.js';
export { a as Flow, F as FlowApi, f as FlowClass, h as FlowEndpointResponse, b as FlowType, n as FlowTypeEnum } from './FlowApi-CASVC-Al.js';
export { B as BaseAPI, d as BaseClass, e as GeneralHeaderInterface, G as GeneralRequestBody, P as Paging, a as RequesterClass, f as RequesterResponseInterface, c as ResponseData, b as ResponsePagination, R as ResponseSuccess } from './base-BhCbbsxB.js';
export { WabaConfigType, WhatsAppConfig } from './shared/types/config.js';
export { H as HttpsClientClass, a as HttpsClientResponseClass, b as ResponseHeaderValue, R as ResponseHeaders, c as ResponseJSONBody, W as WhatsApp } from './index-DiCI1vEz.js';
export { A as AudioMediaTypesEnum, B as BusinessVerticalEnum, b as ButtonPositionEnum, a as CategoryEnum, c as ComponentTypesEnum, d as ConversationTypesEnum, C as CurrencyCodesEnum, D as DataLocalizationRegionEnum, h as DocumentMediaTypesEnum, H as HttpMethodsEnum, g as ImageMediaTypesEnum, I as InteractiveTypesEnum, L as LanguagesEnum, M as MessageTypesEnum, P as ParametersTypesEnum, R as ReferralSourceTypesEnum, k as RequestCodeMethodsEnum, e as StatusEnum, f as StickerMediaTypesEnum, S as SubTypeEnum, j as SystemChangeTypesEnum, T as TemplateStatusEnum, V as VideoMediaTypesEnum, W as WabaConfigEnum, i as WebhookTypesEnum } from './enums-DvwSJq9w.js';
export { E as EncryptionApi } from './EncryptionApi-PHxeI2G_.js';
export { a as MediaClass, b as MediaResponse, c as MediasResponse, U as UploadMediaResponse } from './MediaApi-B2vtjiCm.js';
export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, M as MessagesApi, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from './MessageApi-ptFlWg3O.js';
export { P as PhoneNumberApi, c as PhoneNumberClass, d as PhoneNumberResponse } from './PhoneNumberApi-DMb_G3uw.js';
export { B as BusinessProfileApi, a as BusinessProfileClass, e as BusinessProfileResponse } from './BusinessProfileApi-DE7Nnuy_.js';
export { Q as QrCodeApi, a as QrCodeClass, b as QrCodeResponse } from './QrCodeApi-D3rVKuxV.js';
export { R as RegistrationApi, a as RegistrationClass } from './RegistrationApi-DZBJWAZS.js';
export { f as TemplateApi, b as TemplateClass, e as TemplateResponse } from './TemplateApi-BFeM9qJS.js';
export { T as TwoStepVerificationApi } from './TwoStepVerificationApi-6jV5pDxS.js';
export { b as WABAClass, a as WabaAccount, W as WabaApi } from './WabaApi-B8Gv2UNE.js';
export { MetaError, isMetaError } from './shared/utils/isMetaError.js';
import 'https';
interface LoggerInterface {
log(...data: any[]): void;
error(...data: any[]): void;
warn(...data: any[]): void;
info(...data: any[]): void;
debug(...data: any[]): void;
}
declare function buildFieldsQueryString(fields?: string[] | string): string;
declare class Logger implements LoggerInterface {
private name;
private debug;
constructor(name: string, debug?: boolean);
log(...data: any[]): void;
error(...data: any[]): void;
warn(...data: any[]): void;
info(...data: any[]): void;
}
declare const objectToQueryString: (params: Record<string, any>) => string;
declare const DATA_EXCHANGE_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT, FlowActionEnum.BACK];
declare const ERROR_ACTIONS: readonly [FlowActionEnum.DATA_EXCHANGE, FlowActionEnum.INIT];
/**
* Type guard to check if a request is a Data Exchange request
* Validates the request structure according to the Flow API specifications
*
* @param request The Flow endpoint request to check
* @returns True if the request is a valid Data Exchange request, false otherwise
*/
declare function isFlowDataExchangeRequest(request: FlowEndpointRequest): request is FlowDataExchangeRequest & {
action: (typeof DATA_EXCHANGE_ACTIONS)[number];
screen?: string;
flow_token: string;
data?: Record<string, any>;
};
/**
* Type guard to check if a request is an Error Notification request
* Validates the request structure according to the Flow API error specifications
*
* @param request The Flow endpoint request to check
* @returns True if the request is a valid Error Notification request, false otherwise
*/
declare function isFlowErrorRequest(request: FlowEndpointRequest): request is FlowErrorNotificationRequest & {
action: (typeof ERROR_ACTIONS)[number];
screen: string;
flow_token: string;
data: {
error: string;
error_message: string;
};
};
/**
* Type guard to check if a request is a Ping (health check) request
* Simple validation for health check endpoints in the Flow API
*
* @param request The Flow endpoint request to check
* @returns True if the request is a Ping request, false otherwise
*/
declare function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest;
export { FlowEndpointRequest, Logger, type LoggerInterface, buildFieldsQueryString, isFlowDataExchangeRequest, isFlowErrorRequest, isFlowPingRequest, objectToQueryString };