@oficialapi/sdk 9.0.6 → 9.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -38,7 +38,7 @@ interface Channel {
38
38
  id: number;
39
39
  channelToken: string;
40
40
  nome: string;
41
- channel: 'whatsapp' | 'facebook' | 'instagram' | 'webchat' | 'email' | 'telegram';
41
+ channel: "whatsapp" | "facebook" | "instagram" | "webchat" | "email" | "telegram";
42
42
  status: boolean;
43
43
  numero?: string | null;
44
44
  instagram?: {
@@ -56,7 +56,7 @@ interface SendWhatsAppMediaParams {
56
56
  channelToken: string;
57
57
  sender: string;
58
58
  fileUrl: string;
59
- type: 'image' | 'video' | 'audio' | 'document';
59
+ type: "image" | "video" | "audio" | "document";
60
60
  caption?: string;
61
61
  fileName?: string;
62
62
  }
@@ -66,25 +66,25 @@ interface SendWhatsAppTemplateParams {
66
66
  templateName: string;
67
67
  languageCode: string;
68
68
  components?: Array<{
69
- type: 'HEADER' | 'BODY' | 'BUTTONS';
69
+ type: "HEADER" | "BODY" | "BUTTONS";
70
70
  parameters?: Array<{
71
- type: 'text';
71
+ type: "text";
72
72
  text: string;
73
73
  } | {
74
- type: 'image';
74
+ type: "image";
75
75
  image: {
76
76
  link?: string;
77
77
  id?: string;
78
78
  };
79
79
  } | {
80
- type: 'document';
80
+ type: "document";
81
81
  document: {
82
82
  link?: string;
83
83
  id?: string;
84
84
  filename?: string;
85
85
  };
86
86
  } | {
87
- type: 'video';
87
+ type: "video";
88
88
  video: {
89
89
  link?: string;
90
90
  id?: string;
@@ -138,17 +138,17 @@ interface CreateTemplateParams {
138
138
  channelToken: string;
139
139
  name: string;
140
140
  language: string;
141
- category: 'MARKETING' | 'UTILITY' | 'AUTHENTICATION';
141
+ category: "MARKETING" | "UTILITY" | "AUTHENTICATION";
142
142
  components: Array<{
143
- type: 'HEADER' | 'BODY' | 'FOOTER' | 'BUTTONS';
144
- format?: 'TEXT' | 'IMAGE' | 'VIDEO' | 'DOCUMENT';
143
+ type: "HEADER" | "BODY" | "FOOTER" | "BUTTONS";
144
+ format?: "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT";
145
145
  text?: string;
146
146
  example?: {
147
147
  header_text?: string[];
148
148
  body_text?: string[][];
149
149
  };
150
150
  buttons?: Array<{
151
- type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
151
+ type: "QUICK_REPLY" | "URL" | "PHONE_NUMBER";
152
152
  text?: string;
153
153
  url?: string;
154
154
  phone_number?: string;
@@ -158,7 +158,7 @@ interface CreateTemplateParams {
158
158
  interface UploadMediaParams {
159
159
  channelToken: string;
160
160
  file: File | Blob | Buffer;
161
- mediaType: 'image' | 'video' | 'document';
161
+ mediaType: "image" | "video" | "document";
162
162
  filename?: string;
163
163
  }
164
164
  interface SendOrderDetailsParams {
@@ -168,7 +168,7 @@ interface SendOrderDetailsParams {
168
168
  bodyText: string;
169
169
  footerText?: string;
170
170
  reference_id: string;
171
- type: 'digital-goods' | 'physical-goods';
171
+ type: "digital-goods" | "physical-goods";
172
172
  currency: string;
173
173
  total_amount: {
174
174
  value: number;
@@ -176,7 +176,7 @@ interface SendOrderDetailsParams {
176
176
  description?: string;
177
177
  };
178
178
  order: {
179
- status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
179
+ status: "pending" | "processing" | "partially-shipped" | "shipped" | "completed" | "canceled";
180
180
  catalog_id?: string;
181
181
  items: Array<{
182
182
  retailer_id: string;
@@ -220,12 +220,12 @@ interface SendOrderDetailsParams {
220
220
  };
221
221
  };
222
222
  payment_settings?: Array<{
223
- type: 'pix_dynamic_code' | 'payment_link' | 'boleto' | 'offsite_card_pay';
223
+ type: "pix_dynamic_code" | "payment_link" | "boleto" | "offsite_card_pay";
224
224
  pix_dynamic_code?: {
225
225
  code: string;
226
226
  merchant_name: string;
227
227
  key: string;
228
- key_type: 'CPF' | 'CNPJ' | 'EMAIL' | 'PHONE' | 'EVP';
228
+ key_type: "CPF" | "CNPJ" | "EMAIL" | "PHONE" | "EVP";
229
229
  };
230
230
  payment_link?: {
231
231
  uri: string;
@@ -245,9 +245,9 @@ interface SendOrderStatusParams {
245
245
  bodyText: string;
246
246
  footerText?: string;
247
247
  reference_id: string;
248
- order_status: 'pending' | 'processing' | 'partially-shipped' | 'shipped' | 'completed' | 'canceled';
248
+ order_status: "pending" | "processing" | "partially-shipped" | "shipped" | "completed" | "canceled";
249
249
  status_description?: string;
250
- payment_status?: 'pending' | 'captured' | 'failed';
250
+ payment_status?: "pending" | "captured" | "failed";
251
251
  payment_timestamp?: number;
252
252
  }
253
253
  interface SendWhatsAppAudioParams {
@@ -338,7 +338,7 @@ interface SendWhatsAppCtaUrlParams {
338
338
  buttonText: string;
339
339
  url: string;
340
340
  header?: {
341
- type: 'text' | 'image' | 'video' | 'document';
341
+ type: "text" | "image" | "video" | "document";
342
342
  text?: string;
343
343
  link?: string;
344
344
  };
@@ -350,7 +350,7 @@ interface SendWhatsAppMediaCarouselParams {
350
350
  bodyText: string;
351
351
  cards: Array<{
352
352
  cardIndex: number;
353
- headerType: 'image' | 'video';
353
+ headerType: "image" | "video";
354
354
  headerLink: string;
355
355
  bodyText: string;
356
356
  buttonText: string;
@@ -365,7 +365,7 @@ interface SendTelegramTextParams {
365
365
  channelToken: string;
366
366
  chatId: string | number;
367
367
  text: string;
368
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
368
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
369
369
  replyToMessageId?: number;
370
370
  disableNotification?: boolean;
371
371
  }
@@ -373,9 +373,9 @@ interface SendTelegramMediaParams {
373
373
  channelToken: string;
374
374
  chatId: string | number;
375
375
  fileUrl: string;
376
- type: 'photo' | 'video' | 'audio' | 'document' | 'voice';
376
+ type: "photo" | "video" | "audio" | "document" | "voice";
377
377
  caption?: string;
378
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
378
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
379
379
  replyToMessageId?: number;
380
380
  }
381
381
  interface SendTelegramButtonsParams {
@@ -390,7 +390,7 @@ interface SendTelegramButtonsParams {
390
390
  url: string;
391
391
  };
392
392
  }>>;
393
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
393
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
394
394
  }
395
395
  interface SendTelegramLocationParams {
396
396
  channelToken: string;
@@ -413,7 +413,7 @@ interface SendTelegramPollParams {
413
413
  question: string;
414
414
  options: string[];
415
415
  isAnonymous?: boolean;
416
- type?: 'quiz' | 'regular';
416
+ type?: "quiz" | "regular";
417
417
  correctOptionId?: number;
418
418
  }
419
419
  interface SendTelegramVenueParams {
@@ -428,7 +428,7 @@ interface SendTelegramVenueParams {
428
428
  interface SendTelegramDiceParams {
429
429
  channelToken: string;
430
430
  chatId: string | number;
431
- emoji?: '🎲' | '🎯' | '🏀' | '' | '🎳' | '🎰';
431
+ emoji?: "🎲" | "🎯" | "🏀" | "" | "🎳" | "🎰";
432
432
  }
433
433
  interface SendTelegramStickerParams {
434
434
  channelToken: string;
@@ -453,7 +453,7 @@ interface SendTelegramMediaGroupParams {
453
453
  channelToken: string;
454
454
  chatId: string | number;
455
455
  media: Array<{
456
- type: 'photo' | 'video';
456
+ type: "photo" | "video";
457
457
  media: string;
458
458
  caption?: string;
459
459
  }>;
@@ -473,7 +473,7 @@ interface EditTelegramMessageParams {
473
473
  chatId: string | number;
474
474
  messageId: number;
475
475
  text: string;
476
- parseMode?: 'HTML' | 'Markdown' | 'MarkdownV2';
476
+ parseMode?: "HTML" | "Markdown" | "MarkdownV2";
477
477
  }
478
478
  interface DeleteTelegramMessageParams {
479
479
  channelToken: string;
@@ -495,7 +495,7 @@ interface SendWebChatMediaParams {
495
495
  channelToken: string;
496
496
  chatId: string;
497
497
  fileUrl: string;
498
- type: 'image' | 'video' | 'audio' | 'file';
498
+ type: "image" | "video" | "audio" | "file";
499
499
  caption?: string;
500
500
  typing?: boolean;
501
501
  typingTime?: number;
@@ -510,7 +510,7 @@ interface SendWebChatCarouselParams {
510
510
  buttons?: Array<{
511
511
  id?: string;
512
512
  text: string;
513
- type: 'text' | 'url' | 'phone' | 'postback';
513
+ type: "text" | "url" | "phone" | "postback";
514
514
  value?: string;
515
515
  url?: string;
516
516
  }>;
@@ -526,7 +526,7 @@ interface SendWebChatFormParams {
526
526
  fields: Array<{
527
527
  id?: string;
528
528
  name?: string;
529
- type: 'text' | 'email' | 'number' | 'tel' | 'date' | 'select';
529
+ type: "text" | "email" | "number" | "tel" | "date" | "select";
530
530
  label: string;
531
531
  placeholder?: string;
532
532
  required?: boolean;
@@ -560,7 +560,7 @@ interface SendWebChatCardParams {
560
560
  buttons?: Array<{
561
561
  id?: string;
562
562
  text: string;
563
- type: 'text' | 'url' | 'phone' | 'postback';
563
+ type: "text" | "url" | "phone" | "postback";
564
564
  value?: string;
565
565
  url?: string;
566
566
  }>;
@@ -574,7 +574,7 @@ interface SendWebChatButtonsParams {
574
574
  buttons: Array<{
575
575
  id?: string;
576
576
  text: string;
577
- type: 'text' | 'url' | 'phone' | 'postback';
577
+ type: "text" | "url" | "phone" | "postback";
578
578
  value?: string;
579
579
  url?: string;
580
580
  }>;
@@ -583,19 +583,30 @@ interface SendWebChatButtonsParams {
583
583
  }
584
584
  interface ListPostsParams {
585
585
  channelToken: string;
586
- pageId: string;
586
+ channelType: "facebook" | "instagram";
587
+ pageId?: string;
587
588
  limit?: number;
589
+ after?: string;
590
+ type?: "feed" | "photos" | "videos" | "events" | "media";
591
+ includeComments?: boolean;
592
+ includeReactions?: boolean;
588
593
  }
589
594
  interface ListCommentsParams {
590
595
  channelToken: string;
596
+ channelType: "facebook" | "instagram";
591
597
  postId: string;
592
598
  limit?: number;
599
+ after?: string;
600
+ order?: "created_time" | "like_count";
601
+ filterUnanswered?: boolean;
602
+ includeReplies?: boolean;
593
603
  }
594
604
  interface CreatePostParams {
595
605
  channelToken: string;
596
- pageId: string;
597
606
  message: string;
607
+ channelType: "facebook" | "instagram";
598
608
  link?: string;
609
+ mediaType?: string;
599
610
  }
600
611
  interface ReplyCommentParams {
601
612
  channelToken: string;
@@ -615,7 +626,7 @@ interface SendFacebookMediaParams {
615
626
  channelToken: string;
616
627
  recipientId: string;
617
628
  fileUrl: string;
618
- type: 'image' | 'video' | 'audio' | 'file';
629
+ type: "image" | "video" | "audio" | "file";
619
630
  caption?: string;
620
631
  }
621
632
  interface SendFacebookButtonsParams {
@@ -623,7 +634,7 @@ interface SendFacebookButtonsParams {
623
634
  recipientId: string;
624
635
  message: string;
625
636
  buttons: Array<{
626
- type: 'web_url' | 'postback';
637
+ type: "web_url" | "postback";
627
638
  title: string;
628
639
  url?: string;
629
640
  payload?: string;
@@ -643,7 +654,7 @@ interface ReplyFacebookMediaParams {
643
654
  channelToken: string;
644
655
  messageId: string;
645
656
  fileUrl: string;
646
- type: 'image' | 'video' | 'audio' | 'file';
657
+ type: "image" | "video" | "audio" | "file";
647
658
  caption?: string;
648
659
  }
649
660
  interface SharePostParams {
@@ -678,7 +689,7 @@ interface SendInstagramMediaParams {
678
689
  channelToken: string;
679
690
  recipientId: string;
680
691
  attachment: {
681
- type: 'image' | 'video' | 'audio' | 'file';
692
+ type: "image" | "video" | "audio" | "file";
682
693
  url: string;
683
694
  };
684
695
  tags?: string[];
@@ -694,12 +705,12 @@ interface SendInstagramImagesParams {
694
705
  interface SendInstagramStickerParams {
695
706
  channelToken: string;
696
707
  recipientId: string;
697
- stickerType: 'like' | 'heart';
708
+ stickerType: "like" | "heart";
698
709
  }
699
710
  interface ReactInstagramMessageParams {
700
711
  channelToken: string;
701
712
  messageId: string;
702
- reactionType: 'like' | 'love' | 'wow' | 'haha' | 'sorry' | 'anger';
713
+ reactionType: "like" | "love" | "wow" | "haha" | "sorry" | "anger";
703
714
  }
704
715
  interface RemoveInstagramReactionParams {
705
716
  channelToken: string;
@@ -711,7 +722,7 @@ interface SendInstagramQuickRepliesParams {
711
722
  recipientId: string;
712
723
  message: string;
713
724
  quickReplies: Array<{
714
- content_type: 'text';
725
+ content_type: "text";
715
726
  title: string;
716
727
  payload: string;
717
728
  }>;
@@ -724,7 +735,7 @@ interface SendInstagramGenericTemplateParams {
724
735
  subtitle?: string;
725
736
  image_url?: string;
726
737
  buttons?: Array<{
727
- type: 'web_url' | 'postback';
738
+ type: "web_url" | "postback";
728
739
  title: string;
729
740
  url?: string;
730
741
  payload?: string;
@@ -736,7 +747,7 @@ interface SendInstagramButtonTemplateParams {
736
747
  recipientId: string;
737
748
  text: string;
738
749
  buttons: Array<{
739
- type: 'web_url' | 'postback';
750
+ type: "web_url" | "postback";
740
751
  title: string;
741
752
  url?: string;
742
753
  payload?: string;
@@ -745,7 +756,7 @@ interface SendInstagramButtonTemplateParams {
745
756
  interface SendInstagramSenderActionParams {
746
757
  channelToken: string;
747
758
  recipientId: string;
748
- action: 'typing_on' | 'typing_off' | 'mark_seen';
759
+ action: "typing_on" | "typing_off" | "mark_seen";
749
760
  }
750
761
  interface GetInstagramUserProfileParams {
751
762
  channelToken: string;
@@ -763,8 +774,8 @@ interface DownloadInstagramMediaParams {
763
774
  channelToken: string;
764
775
  url: string;
765
776
  }
766
- type InstagramPublishMediaType = 'IMAGE' | 'VIDEO' | 'REELS' | 'STORIES' | 'CAROUSEL';
767
- type GraduationStrategy = 'MANUAL' | 'SS_PERFORMANCE';
777
+ type InstagramPublishMediaType = "IMAGE" | "VIDEO" | "REELS" | "STORIES" | "CAROUSEL";
778
+ type GraduationStrategy = "MANUAL" | "SS_PERFORMANCE";
768
779
  interface CreateInstagramMediaContainerParams {
769
780
  channelToken: string;
770
781
  image_url?: string;
package/dist/index.js CHANGED
@@ -3,6 +3,6 @@
3
3
  * @version 1.0.0
4
4
  * @license MIT
5
5
  */
6
- var I="https://api.oficialapi.com.br",l=class{constructor(e){this.config={clientId:e.clientId,clientSecret:e.clientSecret,timeout:e.timeout||3e4,maxRetries:e.maxRetries||3,retryDelay:e.retryDelay||1e3,headers:e.headers||{}},this.axiosInstance=P__default.default.create({baseURL:I,timeout:this.config.timeout,headers:{"Content-Type":"application/json",...this.config.headers}}),this.setupInterceptors();}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>{if(e.url?.includes("/auth/token"))return e;let t=e;return t.accessToken&&e.headers&&(e.headers.Authorization=`Bearer ${t.accessToken}`),e},e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t)return Promise.reject(this.formatError(e));if((!e.response||e.response.status>=500&&e.response.status<600)&&(!t._retryCount||t._retryCount<this.config.maxRetries)){t._retryCount=(t._retryCount||0)+1;let s=this.config.retryDelay*t._retryCount;return await new Promise(i=>setTimeout(i,s)),this.axiosInstance(t)}return Promise.reject(this.formatError(e))});}formatError(e){if(e.response){let t=e.response.data,n=t?.error?.message||t?.message||e.message,s=t?.error?.details||[],i=new Error(n);return i.status=e.response.status,i.data=e.response.data,i.details=s,i}return e.request?new Error("Erro de conex\xE3o com a API. Verifique sua conex\xE3o com a internet."):e}async get(e,t,n){let s={...n,accessToken:t};return (await this.axiosInstance.get(e,s)).data}async post(e,t,n,s){let i={...s,accessToken:n};return (await this.axiosInstance.post(e,t,i)).data}async put(e,t,n,s){let i={...s,accessToken:n};return (await this.axiosInstance.put(e,t,i)).data}async delete(e,t,n,s){let i={...s,accessToken:t,data:n};return (await this.axiosInstance.delete(e,i)).data}async upload(e,t,n,s="file",i){let o=new FormData;if(t instanceof Buffer){let y=new Blob([t]);o.append(s,y);}else o.append(s,t);i&&Object.entries(i).forEach(([y,r])=>{r!=null&&o.append(y,typeof r=="string"?r:JSON.stringify(r));});let C={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,o,C)).data}};var d=class{constructor(e){this.httpClient=e;}async getToken(e,t){let n=await this.httpClient.post("/api/v1/auth/token",{client_id:e,client_secret:t});if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao obter token");return n.data}};var c=class{constructor(e){this.httpClient=e;}async list(e){let t=await this.httpClient.get("/api/v1/channels",e);if(!t.success||!t.data)throw new Error(t.error?.message||"Falha ao listar canais");return Array.isArray(t.data)?t.data:[t.data]}};var h=class{constructor(e){this.httpClient=e;}async createWebhook(e,t){let n=await this.httpClient.post("/api/v1/integrations",{url:e.url,expiresInDays:e.expiresInDays},t);if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao criar webhook");return n.data}};var p=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{channelToken:e.channelToken,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{channelToken:e.channelToken,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption,...e.fileName&&{fileName:e.fileName}},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{channelToken:e.channelToken,sender:e.sender,templateName:e.templateName,languageCode:e.languageCode,components:e.components},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/whatsapp/send-buttons",{channelToken:e.channelToken,sender:e.sender,text:e.text,buttons:e.buttons,...e.media&&{media:e.media}},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{channelToken:e.channelToken,sender:e.sender,headerText:e.headerText,bodyText:e.bodyText,buttonText:e.buttonText,sections:e.sections,...e.footerText&&{footerText:e.footerText}},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{channelToken:e.channelToken,sender:e.sender,messageText:e.messageText,...e.replyMessageId&&{replyMessageId:e.replyMessageId},...e.preview_url!==void 0&&{preview_url:e.preview_url}},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{channelToken:e.channelToken,sender:e.sender,emoji:e.emoji,...e.message_id&&{message_id:e.message_id}},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{channelToken:e.channelToken,name:e.name,language:e.language,category:e.category,components:e.components},t)}async listTemplates(e,t){return this.httpClient.get(`/api/v1/whatsapp/templates?channelToken=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?channelToken=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{channelToken:e.channelToken,mediaType:e.mediaType,...e.filename&&{filename:e.filename}})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{channelToken:e.channelToken,sender:e.sender,...e.headerText&&{headerText:e.headerText},bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,type:e.type,currency:e.currency,total_amount:e.total_amount,order:e.order,...e.payment_settings&&{payment_settings:e.payment_settings}},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,order_status:e.order_status,...e.status_description&&{status_description:e.status_description},...e.payment_status&&{payment_status:e.payment_status},...e.payment_timestamp!==void 0&&{payment_timestamp:e.payment_timestamp}},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.voice!==void 0&&{voice:e.voice}},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.caption&&{caption:e.caption}},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.filename&&{filename:e.filename},...e.caption&&{caption:e.caption}},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{channelToken:e.channelToken,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{channelToken:e.channelToken,sender:e.sender,latitude:e.latitude,longitude:e.longitude,name:e.name,address:e.address},t)}async sendLocationRequest(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location-request",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,...e.headerText&&{headerText:e.headerText},...e.footerText&&{footerText:e.footerText}},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,buttonText:e.buttonText,url:e.url,...e.header&&{header:e.header},...e.footerText&&{footerText:e.footerText}},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,cards:e.cards},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/download-media",{channelToken:e.channelToken,url:e.url},t)}};var g=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId,disableNotification:e.disableNotification},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/telegram/send-media",{channelToken:e.channelToken,chatId:e.chatId,fileUrl:e.fileUrl,type:e.type,caption:e.caption,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/telegram/send-buttons",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,buttons:e.buttons,parseMode:e.parseMode},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/telegram/send-location",{channelToken:e.channelToken,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,livePeriod:e.livePeriod},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/telegram/send-contact",{channelToken:e.channelToken,chatId:e.chatId,phoneNumber:e.phoneNumber,firstName:e.firstName,lastName:e.lastName,vcard:e.vcard},t)}async sendPoll(e,t){return this.httpClient.post("/api/v1/telegram/send-poll",{channelToken:e.channelToken,chatId:e.chatId,question:e.question,options:e.options,isAnonymous:e.isAnonymous,type:e.type,correctOptionId:e.correctOptionId},t)}async sendVenue(e,t){return this.httpClient.post("/api/v1/telegram/send-venue",{channelToken:e.channelToken,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,title:e.title,address:e.address,foursquareId:e.foursquareId},t)}async sendDice(e,t){return this.httpClient.post("/api/v1/telegram/send-dice",{channelToken:e.channelToken,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{channelToken:e.channelToken,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{channelToken:e.channelToken,chatId:e.chatId,voiceUrl:e.voiceUrl,caption:e.caption,duration:e.duration},t)}async sendVideoNote(e,t){return this.httpClient.post("/api/v1/telegram/send-video-note",{channelToken:e.channelToken,chatId:e.chatId,videoNoteUrl:e.videoNoteUrl,duration:e.duration,length:e.length},t)}async sendMediaGroup(e,t){return this.httpClient.post("/api/v1/telegram/send-media-group",{channelToken:e.channelToken,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,keyboard:e.keyboard,resizeKeyboard:e.resizeKeyboard,oneTimeKeyboard:e.oneTimeKeyboard},t)}async editMessage(e,t){return this.httpClient.post("/api/v1/telegram/edit-message",{channelToken:e.channelToken,chatId:e.chatId,messageId:e.messageId,text:e.text,parseMode:e.parseMode},t)}async deleteMessage(e,t){return this.httpClient.post("/api/v1/telegram/delete-message",{channelToken:e.channelToken,chatId:e.chatId,messageId:e.messageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/telegram/download-media",{channelToken:e.channelToken,fileId:e.fileId},t)}};var u=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{channelToken:e.channelToken,chatId:e.chatId,type:"text",content:{text:e.messageText,typingTime:e.typingTime},typing:e.typing},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{channelToken:e.channelToken,chatId:e.chatId,type:e.type,content:{url:e.fileUrl,caption:e.caption,typingTime:e.typingTime},typing:e.typing},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{channelToken:e.channelToken,chatId:e.chatId,type:"carousel",content:{cards:e.cards.map(n=>({title:n.title,subtitle:n.subtitle,imageUrl:n.imageUrl,buttons:n.buttons?.map(s=>({id:s.id||`btn_${Date.now()}_${Math.random()}`,text:s.text,type:s.type,value:s.value,url:s.url}))})),typingTime:e.typingTime},typing:e.typing},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{channelToken:e.channelToken,chatId:e.chatId,type:"form",content:{id:e.id,title:e.title,submitText:e.submitButtonText,fields:e.fields.map(n=>({id:n.id||n.name,type:n.type,label:n.label,placeholder:n.placeholder,required:n.required,options:n.options})),typingTime:e.typingTime},typing:e.typing},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{channelToken:e.channelToken,chatId:e.chatId,type:"quickReplies",content:{text:e.messageText,quickReplies:e.quickReplies.map(n=>({id:n.id||`qr_${Date.now()}_${Math.random()}`,text:n.text,value:n.value})),typingTime:e.typingTime},typing:e.typing},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{channelToken:e.channelToken,chatId:e.chatId,type:"card",content:{title:e.title,subtitle:e.description,imageUrl:e.imageUrl,buttons:e.buttons?.map(n=>({id:n.id||`btn_${Date.now()}_${Math.random()}`,text:n.text,type:n.type,value:n.value,url:n.url})),typingTime:e.typingTime},typing:e.typing},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{channelToken:e.channelToken,chatId:e.chatId,type:"buttons",content:{text:e.messageText,buttons:e.buttons.map(n=>({id:n.id||`btn_${Date.now()}_${Math.random()}`,text:n.text,type:n.type,value:n.value,url:n.url})),typingTime:e.typingTime},typing:e.typing},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{channelToken:e.channelToken,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{channelToken:e.channelToken,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{channelToken:e.channelToken,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{channelToken:e.channelToken,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{channelToken:e.channelToken,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{channelToken:e.channelToken,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/facebook/send-buttons",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{channelToken:e.channelToken,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{channelToken:e.channelToken,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{channelToken:e.channelToken,messageId:e.messageId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sharePost(e,t){return this.httpClient.post("/api/v1/facebook/share-post",{channelToken:e.channelToken,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{channelToken:e.channelToken,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{channelToken:e.channelToken,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{channelToken:e.channelToken,url:e.url},t)}};var T=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{channelToken:e.channelToken,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{channelToken:e.channelToken,recipientId:e.recipientId,text:e.text,...e.tags&&{tags:e.tags}},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{channelToken:e.channelToken,recipientId:e.recipientId,attachment:e.attachment,...e.tags&&{tags:e.tags}},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{channelToken:e.channelToken,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{channelToken:e.channelToken,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{channelToken:e.channelToken,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{channelToken:e.channelToken,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{channelToken:e.channelToken,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{channelToken:e.channelToken,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{channelToken:e.channelToken,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{channelToken:e.channelToken,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{channelToken:e.channelToken,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{channelToken:e.channelToken},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/instagram/download-media",{channelToken:e.channelToken,url:e.url},t)}async createMediaContainer(e,t){return this.httpClient.post("/api/v1/instagram/media",{channelToken:e.channelToken,image_url:e.image_url,video_url:e.video_url,media_type:e.media_type,caption:e.caption,is_carousel_item:e.is_carousel_item,children:e.children,upload_type:e.upload_type,trial_params:e.trial_params,alt_text:e.alt_text,location_id:e.location_id,product_tags:e.product_tags,user_tags:e.user_tags},t)}async publishMedia(e,t){return this.httpClient.post("/api/v1/instagram/media_publish",{channelToken:e.channelToken,creation_id:e.creation_id},t)}async getContainerStatus(e,t){return this.httpClient.post(`/api/v1/instagram/media/${e.container_id}/status`,{channelToken:e.channelToken},t)}async getPublishingLimit(e,t){return this.httpClient.post("/api/v1/instagram/content_publishing_limit",{channelToken:e.channelToken},t)}async uploadVideo(e,t){return this.httpClient.post("/api/v1/instagram/upload",{channelToken:e.channelToken,container_id:e.container_id,file_url:e.file_url,offset:e.offset,file_size:e.file_size},t)}};var k=class{constructor(e){this.httpClient=new l(e),this.auth=new d(this.httpClient),this.channels=new c(this.httpClient),this.integrations=new h(this.httpClient),this.whatsapp=new p(this.httpClient),this.telegram=new g(this.httpClient),this.webchat=new u(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new T(this.httpClient);}},K=k;
6
+ var I="https://api.oficialapi.com.br",l=class{constructor(e){this.config={clientId:e.clientId,clientSecret:e.clientSecret,timeout:e.timeout||3e4,maxRetries:e.maxRetries||3,retryDelay:e.retryDelay||1e3,headers:e.headers||{}},this.axiosInstance=P__default.default.create({baseURL:I,timeout:this.config.timeout,headers:{"Content-Type":"application/json",...this.config.headers}}),this.setupInterceptors();}setupInterceptors(){this.axiosInstance.interceptors.request.use(e=>{if(e.url?.includes("/auth/token"))return e;let t=e;return t.accessToken&&e.headers&&(e.headers.Authorization=`Bearer ${t.accessToken}`),e},e=>Promise.reject(e)),this.axiosInstance.interceptors.response.use(e=>e,async e=>{let t=e.config;if(!t)return Promise.reject(this.formatError(e));if((!e.response||e.response.status>=500&&e.response.status<600)&&(!t._retryCount||t._retryCount<this.config.maxRetries)){t._retryCount=(t._retryCount||0)+1;let s=this.config.retryDelay*t._retryCount;return await new Promise(i=>setTimeout(i,s)),this.axiosInstance(t)}return Promise.reject(this.formatError(e))});}formatError(e){if(e.response){let t=e.response.data,n=t?.error?.message||t?.message||e.message,s=t?.error?.details||[],i=new Error(n);return i.status=e.response.status,i.data=e.response.data,i.details=s,i}return e.request?new Error("Erro de conex\xE3o com a API. Verifique sua conex\xE3o com a internet."):e}async get(e,t,n){let s={...n,accessToken:t};return (await this.axiosInstance.get(e,s)).data}async post(e,t,n,s){let i={...s,accessToken:n};return (await this.axiosInstance.post(e,t,i)).data}async put(e,t,n,s){let i={...s,accessToken:n};return (await this.axiosInstance.put(e,t,i)).data}async delete(e,t,n,s){let i={...s,accessToken:t,data:n};return (await this.axiosInstance.delete(e,i)).data}async upload(e,t,n,s="file",i){let o=new FormData;if(t instanceof Buffer){let y=new Blob([t]);o.append(s,y);}else o.append(s,t);i&&Object.entries(i).forEach(([y,r])=>{r!=null&&o.append(y,typeof r=="string"?r:JSON.stringify(r));});let C={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,o,C)).data}};var d=class{constructor(e){this.httpClient=e;}async getToken(e,t){let n=await this.httpClient.post("/api/v1/auth/token",{client_id:e,client_secret:t});if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao obter token");return n.data}};var c=class{constructor(e){this.httpClient=e;}async list(e){let t=await this.httpClient.get("/api/v1/channels",e);if(!t.success||!t.data)throw new Error(t.error?.message||"Falha ao listar canais");return Array.isArray(t.data)?t.data:[t.data]}};var h=class{constructor(e){this.httpClient=e;}async createWebhook(e,t){let n=await this.httpClient.post("/api/v1/integrations",{url:e.url,expiresInDays:e.expiresInDays},t);if(!n.success||!n.data)throw new Error(n.error?.message||"Falha ao criar webhook");return n.data}};var p=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{channelToken:e.channelToken,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{channelToken:e.channelToken,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption,...e.fileName&&{fileName:e.fileName}},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{channelToken:e.channelToken,sender:e.sender,templateName:e.templateName,languageCode:e.languageCode,components:e.components},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/whatsapp/send-buttons",{channelToken:e.channelToken,sender:e.sender,text:e.text,buttons:e.buttons,...e.media&&{media:e.media}},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{channelToken:e.channelToken,sender:e.sender,headerText:e.headerText,bodyText:e.bodyText,buttonText:e.buttonText,sections:e.sections,...e.footerText&&{footerText:e.footerText}},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{channelToken:e.channelToken,sender:e.sender,messageText:e.messageText,...e.replyMessageId&&{replyMessageId:e.replyMessageId},...e.preview_url!==void 0&&{preview_url:e.preview_url}},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{channelToken:e.channelToken,sender:e.sender,emoji:e.emoji,...e.message_id&&{message_id:e.message_id}},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{channelToken:e.channelToken,name:e.name,language:e.language,category:e.category,components:e.components},t)}async listTemplates(e,t){return this.httpClient.get(`/api/v1/whatsapp/templates?channelToken=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?channelToken=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{channelToken:e.channelToken,mediaType:e.mediaType,...e.filename&&{filename:e.filename}})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{channelToken:e.channelToken,sender:e.sender,...e.headerText&&{headerText:e.headerText},bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,type:e.type,currency:e.currency,total_amount:e.total_amount,order:e.order,...e.payment_settings&&{payment_settings:e.payment_settings}},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,...e.footerText&&{footerText:e.footerText},reference_id:e.reference_id,order_status:e.order_status,...e.status_description&&{status_description:e.status_description},...e.payment_status&&{payment_status:e.payment_status},...e.payment_timestamp!==void 0&&{payment_timestamp:e.payment_timestamp}},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.voice!==void 0&&{voice:e.voice}},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.caption&&{caption:e.caption}},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{channelToken:e.channelToken,sender:e.sender,mediaId:e.mediaId,...e.filename&&{filename:e.filename},...e.caption&&{caption:e.caption}},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{channelToken:e.channelToken,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{channelToken:e.channelToken,sender:e.sender,latitude:e.latitude,longitude:e.longitude,name:e.name,address:e.address},t)}async sendLocationRequest(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location-request",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,...e.headerText&&{headerText:e.headerText},...e.footerText&&{footerText:e.footerText}},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,buttonText:e.buttonText,url:e.url,...e.header&&{header:e.header},...e.footerText&&{footerText:e.footerText}},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{channelToken:e.channelToken,sender:e.sender,bodyText:e.bodyText,cards:e.cards},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/download-media",{channelToken:e.channelToken,url:e.url},t)}};var g=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId,disableNotification:e.disableNotification},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/telegram/send-media",{channelToken:e.channelToken,chatId:e.chatId,fileUrl:e.fileUrl,type:e.type,caption:e.caption,parseMode:e.parseMode,replyToMessageId:e.replyToMessageId},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/telegram/send-buttons",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,buttons:e.buttons,parseMode:e.parseMode},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/telegram/send-location",{channelToken:e.channelToken,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,livePeriod:e.livePeriod},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/telegram/send-contact",{channelToken:e.channelToken,chatId:e.chatId,phoneNumber:e.phoneNumber,firstName:e.firstName,lastName:e.lastName,vcard:e.vcard},t)}async sendPoll(e,t){return this.httpClient.post("/api/v1/telegram/send-poll",{channelToken:e.channelToken,chatId:e.chatId,question:e.question,options:e.options,isAnonymous:e.isAnonymous,type:e.type,correctOptionId:e.correctOptionId},t)}async sendVenue(e,t){return this.httpClient.post("/api/v1/telegram/send-venue",{channelToken:e.channelToken,chatId:e.chatId,latitude:e.latitude,longitude:e.longitude,title:e.title,address:e.address,foursquareId:e.foursquareId},t)}async sendDice(e,t){return this.httpClient.post("/api/v1/telegram/send-dice",{channelToken:e.channelToken,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{channelToken:e.channelToken,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{channelToken:e.channelToken,chatId:e.chatId,voiceUrl:e.voiceUrl,caption:e.caption,duration:e.duration},t)}async sendVideoNote(e,t){return this.httpClient.post("/api/v1/telegram/send-video-note",{channelToken:e.channelToken,chatId:e.chatId,videoNoteUrl:e.videoNoteUrl,duration:e.duration,length:e.length},t)}async sendMediaGroup(e,t){return this.httpClient.post("/api/v1/telegram/send-media-group",{channelToken:e.channelToken,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{channelToken:e.channelToken,chatId:e.chatId,text:e.text,keyboard:e.keyboard,resizeKeyboard:e.resizeKeyboard,oneTimeKeyboard:e.oneTimeKeyboard},t)}async editMessage(e,t){return this.httpClient.post("/api/v1/telegram/edit-message",{channelToken:e.channelToken,chatId:e.chatId,messageId:e.messageId,text:e.text,parseMode:e.parseMode},t)}async deleteMessage(e,t){return this.httpClient.post("/api/v1/telegram/delete-message",{channelToken:e.channelToken,chatId:e.chatId,messageId:e.messageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/telegram/download-media",{channelToken:e.channelToken,fileId:e.fileId},t)}};var u=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{channelToken:e.channelToken,chatId:e.chatId,type:"text",content:{text:e.messageText,typingTime:e.typingTime},typing:e.typing},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{channelToken:e.channelToken,chatId:e.chatId,type:e.type,content:{url:e.fileUrl,caption:e.caption,typingTime:e.typingTime},typing:e.typing},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{channelToken:e.channelToken,chatId:e.chatId,type:"carousel",content:{cards:e.cards.map(n=>({title:n.title,subtitle:n.subtitle,imageUrl:n.imageUrl,buttons:n.buttons?.map(s=>({id:s.id||`btn_${Date.now()}_${Math.random()}`,text:s.text,type:s.type,value:s.value,url:s.url}))})),typingTime:e.typingTime},typing:e.typing},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{channelToken:e.channelToken,chatId:e.chatId,type:"form",content:{id:e.id,title:e.title,submitText:e.submitButtonText,fields:e.fields.map(n=>({id:n.id||n.name,type:n.type,label:n.label,placeholder:n.placeholder,required:n.required,options:n.options})),typingTime:e.typingTime},typing:e.typing},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{channelToken:e.channelToken,chatId:e.chatId,type:"quickReplies",content:{text:e.messageText,quickReplies:e.quickReplies.map(n=>({id:n.id||`qr_${Date.now()}_${Math.random()}`,text:n.text,value:n.value})),typingTime:e.typingTime},typing:e.typing},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{channelToken:e.channelToken,chatId:e.chatId,type:"card",content:{title:e.title,subtitle:e.description,imageUrl:e.imageUrl,buttons:e.buttons?.map(n=>({id:n.id||`btn_${Date.now()}_${Math.random()}`,text:n.text,type:n.type,value:n.value,url:n.url})),typingTime:e.typingTime},typing:e.typing},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{channelToken:e.channelToken,chatId:e.chatId,type:"buttons",content:{text:e.messageText,buttons:e.buttons.map(n=>({id:n.id||`btn_${Date.now()}_${Math.random()}`,text:n.text,type:n.type,value:n.value,url:n.url})),typingTime:e.typingTime},typing:e.typing},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{channelToken:e.channelToken,channelType:e.channelType,limit:e.limit,after:e.after,type:e.type,includeComments:e.includeComments,includeReactions:e.includeReactions},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{channelToken:e.channelToken,channelType:e.channelType,postId:e.postId,limit:e.limit,after:e.after,order:e.order,filterUnanswered:e.filterUnanswered,includeReplies:e.includeReplies},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{channelToken:e.channelToken,channelType:e.channelType,messageText:e.message,mediaUrl:e.link,mediaType:e.mediaType},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{channelToken:e.channelToken,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{channelToken:e.channelToken,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{channelToken:e.channelToken,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/facebook/send-buttons",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{channelToken:e.channelToken,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{channelToken:e.channelToken,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{channelToken:e.channelToken,messageId:e.messageId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sharePost(e,t){return this.httpClient.post("/api/v1/facebook/share-post",{channelToken:e.channelToken,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{channelToken:e.channelToken,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{channelToken:e.channelToken,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{channelToken:e.channelToken,url:e.url},t)}};var T=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{channelToken:e.channelToken,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{channelToken:e.channelToken,recipientId:e.recipientId,text:e.text,...e.tags&&{tags:e.tags}},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{channelToken:e.channelToken,recipientId:e.recipientId,attachment:e.attachment,...e.tags&&{tags:e.tags}},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{channelToken:e.channelToken,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{channelToken:e.channelToken,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{channelToken:e.channelToken,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{channelToken:e.channelToken,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{channelToken:e.channelToken,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{channelToken:e.channelToken,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{channelToken:e.channelToken,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{channelToken:e.channelToken,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{channelToken:e.channelToken,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{channelToken:e.channelToken,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{channelToken:e.channelToken},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/instagram/download-media",{channelToken:e.channelToken,url:e.url},t)}async createMediaContainer(e,t){return this.httpClient.post("/api/v1/instagram/media",{channelToken:e.channelToken,image_url:e.image_url,video_url:e.video_url,media_type:e.media_type,caption:e.caption,is_carousel_item:e.is_carousel_item,children:e.children,upload_type:e.upload_type,trial_params:e.trial_params,alt_text:e.alt_text,location_id:e.location_id,product_tags:e.product_tags,user_tags:e.user_tags},t)}async publishMedia(e,t){return this.httpClient.post("/api/v1/instagram/media_publish",{channelToken:e.channelToken,creation_id:e.creation_id},t)}async getContainerStatus(e,t){return this.httpClient.post(`/api/v1/instagram/media/${e.container_id}/status`,{channelToken:e.channelToken},t)}async getPublishingLimit(e,t){return this.httpClient.post("/api/v1/instagram/content_publishing_limit",{channelToken:e.channelToken},t)}async uploadVideo(e,t){return this.httpClient.post("/api/v1/instagram/upload",{channelToken:e.channelToken,container_id:e.container_id,file_url:e.file_url,offset:e.offset,file_size:e.file_size},t)}};var k=class{constructor(e){this.httpClient=new l(e),this.auth=new d(this.httpClient),this.channels=new c(this.httpClient),this.integrations=new h(this.httpClient),this.whatsapp=new p(this.httpClient),this.telegram=new g(this.httpClient),this.webchat=new u(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new T(this.httpClient);}},K=k;
7
7
  exports.OficialAPISDK=k;exports.default=K;//# sourceMappingURL=index.js.map
8
8
  //# sourceMappingURL=index.js.map