@oficialapi/sdk 3.0.0 → 4.0.0
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/README.md +62 -0
- package/dist/index.d.mts +48 -6
- package/dist/index.d.ts +48 -6
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -306,6 +306,21 @@ await sdk.whatsapp.sendMediaCarousel({
|
|
|
306
306
|
}, accessToken);
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
+
#### Baixar Mídia Descriptografada
|
|
310
|
+
|
|
311
|
+
```typescript
|
|
312
|
+
const media = await sdk.whatsapp.downloadMedia({
|
|
313
|
+
token: 'sk_live_...',
|
|
314
|
+
url: 'https://lookaside.fbsbx.com/whatsapp_business/attachment/?mid=...'
|
|
315
|
+
}, accessToken);
|
|
316
|
+
|
|
317
|
+
// A mídia retorna em base64
|
|
318
|
+
console.log(media.data.buffer); // Base64 string
|
|
319
|
+
console.log(media.data.mimeType); // image/jpeg, video/mp4, etc.
|
|
320
|
+
console.log(media.data.filename); // Nome do arquivo
|
|
321
|
+
console.log(media.data.size); // Tamanho em bytes
|
|
322
|
+
```
|
|
323
|
+
|
|
309
324
|
#### Responder Mensagem
|
|
310
325
|
|
|
311
326
|
```typescript
|
|
@@ -544,6 +559,23 @@ await sdk.telegram.deleteMessage({
|
|
|
544
559
|
}, accessToken);
|
|
545
560
|
```
|
|
546
561
|
|
|
562
|
+
#### Baixar Mídia Descriptografada
|
|
563
|
+
|
|
564
|
+
```typescript
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
const media = await sdk.telegram.downloadMedia({
|
|
568
|
+
token: 'sk_live_...',
|
|
569
|
+
fileId: 'AgACAgEAAxkBAAItNmlmklyYNCEtvaFphVfSSO7CrEOjAALUC2sbh9owR9hT7MhQnTGfAQADAgADcwADOAQ'
|
|
570
|
+
}, accessToken);
|
|
571
|
+
|
|
572
|
+
// A mídia retorna em base64
|
|
573
|
+
console.log(media.data.buffer); // Base64 string
|
|
574
|
+
console.log(media.data.mimeType); // image/jpeg, video/mp4, etc.
|
|
575
|
+
console.log(media.data.filename); // Nome do arquivo
|
|
576
|
+
console.log(media.data.size); // Tamanho em bytes
|
|
577
|
+
```
|
|
578
|
+
|
|
547
579
|
### WebChat
|
|
548
580
|
|
|
549
581
|
#### Enviar Mensagem de Texto
|
|
@@ -816,6 +848,21 @@ const pageProfile = await sdk.facebook.getPageProfile({
|
|
|
816
848
|
}, accessToken);
|
|
817
849
|
```
|
|
818
850
|
|
|
851
|
+
#### Baixar Mídia Descriptografada
|
|
852
|
+
|
|
853
|
+
```typescript
|
|
854
|
+
const media = await sdk.facebook.downloadMedia({
|
|
855
|
+
token: 'sk_live_...',
|
|
856
|
+
url: 'https://lookaside.fbsbx.com/ig_messaging_cdn/...'
|
|
857
|
+
}, accessToken);
|
|
858
|
+
|
|
859
|
+
// A mídia retorna em base64
|
|
860
|
+
console.log(media.data.buffer); // Base64 string
|
|
861
|
+
console.log(media.data.mimeType); // image/jpeg, video/mp4, etc.
|
|
862
|
+
console.log(media.data.filename); // Nome do arquivo
|
|
863
|
+
console.log(media.data.size); // Tamanho em bytes
|
|
864
|
+
```
|
|
865
|
+
|
|
819
866
|
### Instagram
|
|
820
867
|
|
|
821
868
|
#### Enviar Mensagem de Texto
|
|
@@ -1006,6 +1053,21 @@ const businessProfile = await sdk.instagram.getBusinessProfile({
|
|
|
1006
1053
|
}, accessToken);
|
|
1007
1054
|
```
|
|
1008
1055
|
|
|
1056
|
+
#### Baixar Mídia Descriptografada
|
|
1057
|
+
|
|
1058
|
+
```typescript
|
|
1059
|
+
const media = await sdk.instagram.downloadMedia({
|
|
1060
|
+
token: 'sk_live_...',
|
|
1061
|
+
url: 'https://lookaside.fbsbx.com/ig_messaging_cdn/...'
|
|
1062
|
+
}, accessToken);
|
|
1063
|
+
|
|
1064
|
+
// A mídia retorna em base64
|
|
1065
|
+
console.log(media.data.buffer); // Base64 string
|
|
1066
|
+
console.log(media.data.mimeType); // image/jpeg, video/mp4, etc.
|
|
1067
|
+
console.log(media.data.filename); // Nome do arquivo
|
|
1068
|
+
console.log(media.data.size); // Tamanho em bytes
|
|
1069
|
+
```
|
|
1070
|
+
|
|
1009
1071
|
### Canais
|
|
1010
1072
|
|
|
1011
1073
|
#### Listar Canais
|
package/dist/index.d.mts
CHANGED
|
@@ -272,6 +272,10 @@ interface SendWhatsAppMediaCarouselParams {
|
|
|
272
272
|
}>;
|
|
273
273
|
}>;
|
|
274
274
|
}
|
|
275
|
+
interface DownloadWhatsAppMediaParams {
|
|
276
|
+
token: string;
|
|
277
|
+
url: string;
|
|
278
|
+
}
|
|
275
279
|
interface SendTelegramTextParams {
|
|
276
280
|
token: string;
|
|
277
281
|
chatId: string | number;
|
|
@@ -391,6 +395,10 @@ interface DeleteTelegramMessageParams {
|
|
|
391
395
|
chatId: string | number;
|
|
392
396
|
messageId: number;
|
|
393
397
|
}
|
|
398
|
+
interface DownloadTelegramMediaParams {
|
|
399
|
+
token: string;
|
|
400
|
+
fileId: string;
|
|
401
|
+
}
|
|
394
402
|
interface SendWebChatTextParams {
|
|
395
403
|
token: string;
|
|
396
404
|
sender: string;
|
|
@@ -540,6 +548,10 @@ interface GetFacebookPageProfileParams {
|
|
|
540
548
|
token: string;
|
|
541
549
|
pageId: string;
|
|
542
550
|
}
|
|
551
|
+
interface DownloadFacebookMediaParams {
|
|
552
|
+
token: string;
|
|
553
|
+
url: string;
|
|
554
|
+
}
|
|
543
555
|
interface SendInstagramPrivateReplyParams {
|
|
544
556
|
token: string;
|
|
545
557
|
commentId: string;
|
|
@@ -633,6 +645,10 @@ interface ListInstagramPostsParams {
|
|
|
633
645
|
interface GetInstagramBusinessProfileParams {
|
|
634
646
|
token: string;
|
|
635
647
|
}
|
|
648
|
+
interface DownloadInstagramMediaParams {
|
|
649
|
+
token: string;
|
|
650
|
+
url: string;
|
|
651
|
+
}
|
|
636
652
|
interface CreateWebhookParams {
|
|
637
653
|
url: string;
|
|
638
654
|
expiresInDays?: number;
|
|
@@ -865,6 +881,12 @@ declare class WhatsAppModule {
|
|
|
865
881
|
* @param accessToken Token de acesso do usuário
|
|
866
882
|
*/
|
|
867
883
|
sendMediaCarousel(params: SendWhatsAppMediaCarouselParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
884
|
+
/**
|
|
885
|
+
* Baixa uma mídia descriptografada do WhatsApp usando a URL
|
|
886
|
+
* @param params Parâmetros do download
|
|
887
|
+
* @param accessToken Token de acesso do usuário
|
|
888
|
+
*/
|
|
889
|
+
downloadMedia(params: DownloadWhatsAppMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
868
890
|
}
|
|
869
891
|
|
|
870
892
|
/**
|
|
@@ -963,6 +985,12 @@ declare class TelegramModule {
|
|
|
963
985
|
* @param accessToken Token de acesso do usuário
|
|
964
986
|
*/
|
|
965
987
|
deleteMessage(params: DeleteTelegramMessageParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
988
|
+
/**
|
|
989
|
+
* Baixa uma mídia descriptografada do Telegram usando o file_id
|
|
990
|
+
* @param params Parâmetros do download
|
|
991
|
+
* @param accessToken Token de acesso do usuário
|
|
992
|
+
*/
|
|
993
|
+
downloadMedia(params: DownloadTelegramMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
966
994
|
}
|
|
967
995
|
|
|
968
996
|
/**
|
|
@@ -1105,6 +1133,12 @@ declare class FacebookModule {
|
|
|
1105
1133
|
* @param accessToken Token de acesso do usuário
|
|
1106
1134
|
*/
|
|
1107
1135
|
getPageProfile(params: GetFacebookPageProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Baixa uma mídia descriptografada do Facebook/Instagram usando a URL
|
|
1138
|
+
* @param params Parâmetros do download
|
|
1139
|
+
* @param accessToken Token de acesso do usuário
|
|
1140
|
+
*/
|
|
1141
|
+
downloadMedia(params: DownloadFacebookMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1108
1142
|
}
|
|
1109
1143
|
|
|
1110
1144
|
/**
|
|
@@ -1185,11 +1219,13 @@ declare class InstagramModule {
|
|
|
1185
1219
|
* Obtém informações de perfil de um usuário do Instagram.
|
|
1186
1220
|
*
|
|
1187
1221
|
* Campos retornados:
|
|
1188
|
-
* -
|
|
1189
|
-
* -
|
|
1190
|
-
* - username: Nome de usuário
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
1222
|
+
* - id: ID do usuário
|
|
1223
|
+
* - name: Nome do usuário (pode ser nulo)
|
|
1224
|
+
* - username: Nome de usuário do Instagram
|
|
1225
|
+
*
|
|
1226
|
+
* ⚠️ Nota: A API do Instagram Graph API para usuários regulares (tipo User)
|
|
1227
|
+
* retorna apenas campos básicos. Campos como foto de perfil, número de seguidores
|
|
1228
|
+
* e status de verificação não estão disponíveis para usuários regulares.
|
|
1193
1229
|
*
|
|
1194
1230
|
* ⚠️ O usuário deve ter enviado mensagem direta para sua conta.
|
|
1195
1231
|
* Não é possível obter perfil de quem apenas comentou.
|
|
@@ -1212,6 +1248,12 @@ declare class InstagramModule {
|
|
|
1212
1248
|
* @param accessToken Token de acesso do usuário
|
|
1213
1249
|
*/
|
|
1214
1250
|
getBusinessProfile(params: GetInstagramBusinessProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Baixa uma mídia descriptografada do Instagram usando a URL
|
|
1253
|
+
* @param params Parâmetros do download
|
|
1254
|
+
* @param accessToken Token de acesso do usuário
|
|
1255
|
+
*/
|
|
1256
|
+
downloadMedia(params: DownloadInstagramMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1215
1257
|
}
|
|
1216
1258
|
|
|
1217
1259
|
/**
|
|
@@ -1247,4 +1289,4 @@ declare class OficialAPISDK {
|
|
|
1247
1289
|
constructor(config: SDKConfig);
|
|
1248
1290
|
}
|
|
1249
1291
|
|
|
1250
|
-
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type EditTelegramMessageParams, type GetFacebookPageProfileParams, type GetFacebookUserProfileParams, type GetInstagramBusinessProfileParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type RemoveInstagramReactionParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|
|
1292
|
+
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type DownloadFacebookMediaParams, type DownloadInstagramMediaParams, type DownloadTelegramMediaParams, type DownloadWhatsAppMediaParams, type EditTelegramMessageParams, type GetFacebookPageProfileParams, type GetFacebookUserProfileParams, type GetInstagramBusinessProfileParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type RemoveInstagramReactionParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -272,6 +272,10 @@ interface SendWhatsAppMediaCarouselParams {
|
|
|
272
272
|
}>;
|
|
273
273
|
}>;
|
|
274
274
|
}
|
|
275
|
+
interface DownloadWhatsAppMediaParams {
|
|
276
|
+
token: string;
|
|
277
|
+
url: string;
|
|
278
|
+
}
|
|
275
279
|
interface SendTelegramTextParams {
|
|
276
280
|
token: string;
|
|
277
281
|
chatId: string | number;
|
|
@@ -391,6 +395,10 @@ interface DeleteTelegramMessageParams {
|
|
|
391
395
|
chatId: string | number;
|
|
392
396
|
messageId: number;
|
|
393
397
|
}
|
|
398
|
+
interface DownloadTelegramMediaParams {
|
|
399
|
+
token: string;
|
|
400
|
+
fileId: string;
|
|
401
|
+
}
|
|
394
402
|
interface SendWebChatTextParams {
|
|
395
403
|
token: string;
|
|
396
404
|
sender: string;
|
|
@@ -540,6 +548,10 @@ interface GetFacebookPageProfileParams {
|
|
|
540
548
|
token: string;
|
|
541
549
|
pageId: string;
|
|
542
550
|
}
|
|
551
|
+
interface DownloadFacebookMediaParams {
|
|
552
|
+
token: string;
|
|
553
|
+
url: string;
|
|
554
|
+
}
|
|
543
555
|
interface SendInstagramPrivateReplyParams {
|
|
544
556
|
token: string;
|
|
545
557
|
commentId: string;
|
|
@@ -633,6 +645,10 @@ interface ListInstagramPostsParams {
|
|
|
633
645
|
interface GetInstagramBusinessProfileParams {
|
|
634
646
|
token: string;
|
|
635
647
|
}
|
|
648
|
+
interface DownloadInstagramMediaParams {
|
|
649
|
+
token: string;
|
|
650
|
+
url: string;
|
|
651
|
+
}
|
|
636
652
|
interface CreateWebhookParams {
|
|
637
653
|
url: string;
|
|
638
654
|
expiresInDays?: number;
|
|
@@ -865,6 +881,12 @@ declare class WhatsAppModule {
|
|
|
865
881
|
* @param accessToken Token de acesso do usuário
|
|
866
882
|
*/
|
|
867
883
|
sendMediaCarousel(params: SendWhatsAppMediaCarouselParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
884
|
+
/**
|
|
885
|
+
* Baixa uma mídia descriptografada do WhatsApp usando a URL
|
|
886
|
+
* @param params Parâmetros do download
|
|
887
|
+
* @param accessToken Token de acesso do usuário
|
|
888
|
+
*/
|
|
889
|
+
downloadMedia(params: DownloadWhatsAppMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
868
890
|
}
|
|
869
891
|
|
|
870
892
|
/**
|
|
@@ -963,6 +985,12 @@ declare class TelegramModule {
|
|
|
963
985
|
* @param accessToken Token de acesso do usuário
|
|
964
986
|
*/
|
|
965
987
|
deleteMessage(params: DeleteTelegramMessageParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
988
|
+
/**
|
|
989
|
+
* Baixa uma mídia descriptografada do Telegram usando o file_id
|
|
990
|
+
* @param params Parâmetros do download
|
|
991
|
+
* @param accessToken Token de acesso do usuário
|
|
992
|
+
*/
|
|
993
|
+
downloadMedia(params: DownloadTelegramMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
966
994
|
}
|
|
967
995
|
|
|
968
996
|
/**
|
|
@@ -1105,6 +1133,12 @@ declare class FacebookModule {
|
|
|
1105
1133
|
* @param accessToken Token de acesso do usuário
|
|
1106
1134
|
*/
|
|
1107
1135
|
getPageProfile(params: GetFacebookPageProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1136
|
+
/**
|
|
1137
|
+
* Baixa uma mídia descriptografada do Facebook/Instagram usando a URL
|
|
1138
|
+
* @param params Parâmetros do download
|
|
1139
|
+
* @param accessToken Token de acesso do usuário
|
|
1140
|
+
*/
|
|
1141
|
+
downloadMedia(params: DownloadFacebookMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1108
1142
|
}
|
|
1109
1143
|
|
|
1110
1144
|
/**
|
|
@@ -1185,11 +1219,13 @@ declare class InstagramModule {
|
|
|
1185
1219
|
* Obtém informações de perfil de um usuário do Instagram.
|
|
1186
1220
|
*
|
|
1187
1221
|
* Campos retornados:
|
|
1188
|
-
* -
|
|
1189
|
-
* -
|
|
1190
|
-
* - username: Nome de usuário
|
|
1191
|
-
*
|
|
1192
|
-
*
|
|
1222
|
+
* - id: ID do usuário
|
|
1223
|
+
* - name: Nome do usuário (pode ser nulo)
|
|
1224
|
+
* - username: Nome de usuário do Instagram
|
|
1225
|
+
*
|
|
1226
|
+
* ⚠️ Nota: A API do Instagram Graph API para usuários regulares (tipo User)
|
|
1227
|
+
* retorna apenas campos básicos. Campos como foto de perfil, número de seguidores
|
|
1228
|
+
* e status de verificação não estão disponíveis para usuários regulares.
|
|
1193
1229
|
*
|
|
1194
1230
|
* ⚠️ O usuário deve ter enviado mensagem direta para sua conta.
|
|
1195
1231
|
* Não é possível obter perfil de quem apenas comentou.
|
|
@@ -1212,6 +1248,12 @@ declare class InstagramModule {
|
|
|
1212
1248
|
* @param accessToken Token de acesso do usuário
|
|
1213
1249
|
*/
|
|
1214
1250
|
getBusinessProfile(params: GetInstagramBusinessProfileParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1251
|
+
/**
|
|
1252
|
+
* Baixa uma mídia descriptografada do Instagram usando a URL
|
|
1253
|
+
* @param params Parâmetros do download
|
|
1254
|
+
* @param accessToken Token de acesso do usuário
|
|
1255
|
+
*/
|
|
1256
|
+
downloadMedia(params: DownloadInstagramMediaParams, accessToken: string): Promise<ApiResponse<any>>;
|
|
1215
1257
|
}
|
|
1216
1258
|
|
|
1217
1259
|
/**
|
|
@@ -1247,4 +1289,4 @@ declare class OficialAPISDK {
|
|
|
1247
1289
|
constructor(config: SDKConfig);
|
|
1248
1290
|
}
|
|
1249
1291
|
|
|
1250
|
-
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type EditTelegramMessageParams, type GetFacebookPageProfileParams, type GetFacebookUserProfileParams, type GetInstagramBusinessProfileParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type RemoveInstagramReactionParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|
|
1292
|
+
export { type ApiResponse, type Channel, type CreatePostParams, type CreateTemplateParams, type CreateWebhookParams, type DeleteCommentParams, type DeleteTelegramMessageParams, type DownloadFacebookMediaParams, type DownloadInstagramMediaParams, type DownloadTelegramMediaParams, type DownloadWhatsAppMediaParams, type EditTelegramMessageParams, type GetFacebookPageProfileParams, type GetFacebookUserProfileParams, type GetInstagramBusinessProfileParams, type GetInstagramUserProfileParams, type ListCommentsParams, type ListInstagramPostsParams, type ListPostsParams, OficialAPISDK, type ReactInstagramMessageParams, type ReactWhatsAppParams, type RemoveInstagramReactionParams, type ReplyCommentParams, type ReplyFacebookMediaParams, type ReplyFacebookMessageParams, type ReplyWhatsAppParams, type SDKConfig, type SendFacebookButtonsParams, type SendFacebookMediaParams, type SendFacebookStickerParams, type SendFacebookTextParams, type SendInstagramButtonTemplateParams, type SendInstagramGenericTemplateParams, type SendInstagramImagesParams, type SendInstagramMediaParams, type SendInstagramPrivateReplyParams, type SendInstagramQuickRepliesParams, type SendInstagramSenderActionParams, type SendInstagramStickerParams, type SendInstagramTextParams, type SendOrderDetailsParams, type SendOrderStatusParams, type SendTelegramButtonsParams, type SendTelegramContactParams, type SendTelegramDiceParams, type SendTelegramLocationParams, type SendTelegramMediaGroupParams, type SendTelegramMediaParams, type SendTelegramPollParams, type SendTelegramReplyKeyboardParams, type SendTelegramStickerParams, type SendTelegramTextParams, type SendTelegramVenueParams, type SendTelegramVideoNoteParams, type SendTelegramVoiceParams, type SendWebChatButtonsParams, type SendWebChatCardParams, type SendWebChatCarouselParams, type SendWebChatFormParams, type SendWebChatMediaParams, type SendWebChatQuickRepliesParams, type SendWebChatTextParams, type SendWhatsAppAudioParams, type SendWhatsAppButtonsParams, type SendWhatsAppContactParams, type SendWhatsAppCtaUrlParams, type SendWhatsAppDocumentParams, type SendWhatsAppListParams, type SendWhatsAppLocationParams, type SendWhatsAppLocationRequestParams, type SendWhatsAppMediaCarouselParams, type SendWhatsAppMediaParams, type SendWhatsAppStickerParams, type SendWhatsAppTemplateParams, type SendWhatsAppTextParams, type SendWhatsAppVideoParams, type SharePostParams, type TokenResponse, type UploadMediaParams, type Webhook, OficialAPISDK as default };
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* @version 1.0.0
|
|
4
4
|
* @license MIT
|
|
5
5
|
*/
|
|
6
|
-
var f="https://api.oficialapi.com.br",a=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=I__default.default.create({baseURL:f,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 i=this.config.retryDelay*t._retryCount;return await new Promise(s=>setTimeout(s,i)),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,i=t?.error?.details||[],s=new Error(n);return s.status=e.response.status,s.data=e.response.data,s.details=i,s}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 i={...n,accessToken:t};return (await this.axiosInstance.get(e,i)).data}async post(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.post(e,t,s)).data}async put(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.put(e,t,s)).data}async delete(e,t,n,i){let s={...i,accessToken:t,data:n};return (await this.axiosInstance.delete(e,s)).data}async upload(e,t,n,i="file",s){let r=new FormData;if(t instanceof Buffer){let k=new Blob([t]);r.append(i,k);}else r.append(i,t);s&&Object.entries(s).forEach(([k,C])=>{r.append(k,typeof C=="string"?C:JSON.stringify(C));});let P={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,r,P)).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 p=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 c=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 l=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{token:e.token,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",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,sections:e.sections},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{token:e.token,messageId:e.messageId,messageText:e.messageText},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{token:e.token,messageId:e.messageId,emoji:e.emoji},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{token:e.token,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?token=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?token=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{token:e.token,filename:e.filename})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{token:e.token,sender:e.sender,orderId:e.orderId,orderItems:e.orderItems,orderTotal:e.orderTotal,currency:e.currency,paymentMethods:e.paymentMethods},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{token:e.token,sender:e.sender,orderId:e.orderId,status:e.status,messageText:e.messageText},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{token:e.token,sender:e.sender,audioUrl:e.audioUrl},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{token:e.token,sender:e.sender,stickerUrl:e.stickerUrl},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{token:e.token,sender:e.sender,videoUrl:e.videoUrl,caption:e.caption},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{token:e.token,sender:e.sender,documentUrl:e.documentUrl,filename:e.filename,caption:e.caption},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{token:e.token,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{token:e.token,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",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,url:e.url},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}};var h=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{token:e.token,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,messageId:e.messageId},t)}};var g=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{token:e.token,sender:e.sender,title:e.title,fields:e.fields,submitButtonText:e.submitButtonText},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{token:e.token,sender:e.sender,messageText:e.messageText,quickReplies:e.quickReplies},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{token:e.token,sender:e.sender,title:e.title,description:e.description,imageUrl:e.imageUrl,buttons:e.buttons},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{token:e.token,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{token:e.token,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{token:e.token,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{token:e.token,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{token:e.token,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{token:e.token,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",{token:e.token,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{token:e.token,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{token:e.token,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{token:e.token,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",{token:e.token,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{token:e.token,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{token:e.token,pageId:e.pageId},t)}};var u=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{token:e.token,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{token:e.token,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{token:e.token,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{token:e.token,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{token:e.token,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{token:e.token,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{token:e.token,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{token:e.token,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{token:e.token,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{token:e.token,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{token:e.token,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{token:e.token},t)}};var y=class{constructor(e){this.httpClient=new a(e),this.auth=new d(this.httpClient),this.channels=new p(this.httpClient),this.integrations=new c(this.httpClient),this.whatsapp=new l(this.httpClient),this.telegram=new h(this.httpClient),this.webchat=new g(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new u(this.httpClient);}},j=y;
|
|
7
|
-
exports.OficialAPISDK=
|
|
6
|
+
var f="https://api.oficialapi.com.br",r=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=I__default.default.create({baseURL:f,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 i=this.config.retryDelay*t._retryCount;return await new Promise(s=>setTimeout(s,i)),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,i=t?.error?.details||[],s=new Error(n);return s.status=e.response.status,s.data=e.response.data,s.details=i,s}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 i={...n,accessToken:t};return (await this.axiosInstance.get(e,i)).data}async post(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.post(e,t,s)).data}async put(e,t,n,i){let s={...i,accessToken:n};return (await this.axiosInstance.put(e,t,s)).data}async delete(e,t,n,i){let s={...i,accessToken:t,data:n};return (await this.axiosInstance.delete(e,s)).data}async upload(e,t,n,i="file",s){let a=new FormData;if(t instanceof Buffer){let k=new Blob([t]);a.append(i,k);}else a.append(i,t);s&&Object.entries(s).forEach(([k,C])=>{a.append(k,typeof C=="string"?C:JSON.stringify(C));});let y={headers:{"Content-Type":"multipart/form-data"},accessToken:n};return (await this.axiosInstance.post(e,a,y)).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 p=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 l=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 c=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/whatsapp/send-message",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/send-template",{token:e.token,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",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}async sendList(e,t){return this.httpClient.post("/api/v1/whatsapp/send-list",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,sections:e.sections},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/reply-message",{token:e.token,messageId:e.messageId,messageText:e.messageText},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/whatsapp/react-message",{token:e.token,messageId:e.messageId,emoji:e.emoji},t)}async createTemplate(e,t){return this.httpClient.post("/api/v1/whatsapp/create-template",{token:e.token,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?token=${encodeURIComponent(e)}`,t)}async getTemplate(e,t,n){return this.httpClient.get(`/api/v1/whatsapp/templates/${t}?token=${encodeURIComponent(e)}`,n)}async uploadMedia(e,t){return this.httpClient.upload("/api/v1/whatsapp/upload-media",e.file,t,"file",{token:e.token,filename:e.filename})}async sendOrderDetails(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-details",{token:e.token,sender:e.sender,orderId:e.orderId,orderItems:e.orderItems,orderTotal:e.orderTotal,currency:e.currency,paymentMethods:e.paymentMethods},t)}async sendOrderStatus(e,t){return this.httpClient.post("/api/v1/whatsapp/send-order-status",{token:e.token,sender:e.sender,orderId:e.orderId,status:e.status,messageText:e.messageText},t)}async sendAudio(e,t){return this.httpClient.post("/api/v1/whatsapp/send-audio",{token:e.token,sender:e.sender,audioUrl:e.audioUrl},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/whatsapp/send-sticker",{token:e.token,sender:e.sender,stickerUrl:e.stickerUrl},t)}async sendVideo(e,t){return this.httpClient.post("/api/v1/whatsapp/send-video",{token:e.token,sender:e.sender,videoUrl:e.videoUrl,caption:e.caption},t)}async sendDocument(e,t){return this.httpClient.post("/api/v1/whatsapp/send-document",{token:e.token,sender:e.sender,documentUrl:e.documentUrl,filename:e.filename,caption:e.caption},t)}async sendContact(e,t){return this.httpClient.post("/api/v1/whatsapp/send-contact",{token:e.token,sender:e.sender,contacts:e.contacts},t)}async sendLocation(e,t){return this.httpClient.post("/api/v1/whatsapp/send-location",{token:e.token,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",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendCtaUrl(e,t){return this.httpClient.post("/api/v1/whatsapp/send-cta-url",{token:e.token,sender:e.sender,messageText:e.messageText,buttonText:e.buttonText,url:e.url},t)}async sendMediaCarousel(e,t){return this.httpClient.post("/api/v1/whatsapp/send-media-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/whatsapp/download-media",{token:e.token,url:e.url},t)}};var h=class{constructor(e){this.httpClient=e;}async sendMessage(e,t){return this.httpClient.post("/api/v1/telegram/send-message",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,emoji:e.emoji},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/telegram/send-sticker",{token:e.token,chatId:e.chatId,stickerUrl:e.stickerUrl},t)}async sendVoice(e,t){return this.httpClient.post("/api/v1/telegram/send-voice",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,media:e.media},t)}async sendReplyKeyboard(e,t){return this.httpClient.post("/api/v1/telegram/send-reply-keyboard",{token:e.token,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",{token:e.token,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",{token:e.token,chatId:e.chatId,messageId:e.messageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/telegram/download-media",{token:e.token,fileId:e.fileId},t)}};var g=class{constructor(e){this.httpClient=e;}async sendText(e,t){return this.httpClient.post("/api/v1/webchat/send-text",{token:e.token,sender:e.sender,messageText:e.messageText},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/webchat/send-media",{token:e.token,sender:e.sender,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendCarousel(e,t){return this.httpClient.post("/api/v1/webchat/send-carousel",{token:e.token,sender:e.sender,cards:e.cards},t)}async sendForm(e,t){return this.httpClient.post("/api/v1/webchat/send-form",{token:e.token,sender:e.sender,title:e.title,fields:e.fields,submitButtonText:e.submitButtonText},t)}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/webchat/send-quick-replies",{token:e.token,sender:e.sender,messageText:e.messageText,quickReplies:e.quickReplies},t)}async sendCard(e,t){return this.httpClient.post("/api/v1/webchat/send-card",{token:e.token,sender:e.sender,title:e.title,description:e.description,imageUrl:e.imageUrl,buttons:e.buttons},t)}async sendButtons(e,t){return this.httpClient.post("/api/v1/webchat/send-buttons",{token:e.token,sender:e.sender,messageText:e.messageText,buttons:e.buttons},t)}};var m=class{constructor(e){this.httpClient=e;}async listPosts(e,t){return this.httpClient.post("/api/v1/facebook/list-posts",{token:e.token,pageId:e.pageId,limit:e.limit},t)}async listComments(e,t){return this.httpClient.post("/api/v1/facebook/list-comments",{token:e.token,postId:e.postId,limit:e.limit},t)}async createPost(e,t){return this.httpClient.post("/api/v1/facebook/create-post",{token:e.token,pageId:e.pageId,message:e.message,link:e.link},t)}async replyComment(e,t){return this.httpClient.post("/api/v1/facebook/reply-comment",{token:e.token,commentId:e.commentId,message:e.message},t)}async deleteComment(e,t){return this.httpClient.post("/api/v1/facebook/delete-comment",{token:e.token,commentId:e.commentId},t)}async sendText(e,t){return this.httpClient.post("/api/v1/facebook/send-text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/facebook/send-media",{token:e.token,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",{token:e.token,recipientId:e.recipientId,message:e.message,buttons:e.buttons},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/facebook/send-sticker",{token:e.token,recipientId:e.recipientId,stickerId:e.stickerId},t)}async replyMessage(e,t){return this.httpClient.post("/api/v1/facebook/reply-message",{token:e.token,messageId:e.messageId,message:e.message},t)}async replyMedia(e,t){return this.httpClient.post("/api/v1/facebook/reply-media",{token:e.token,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",{token:e.token,mediaId:e.mediaId,recipientId:e.recipientId},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/facebook/user-profile",{token:e.token,userId:e.userId},t)}async getPageProfile(e,t){return this.httpClient.post("/api/v1/facebook/page-profile",{token:e.token,pageId:e.pageId},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/facebook/download-media",{token:e.token,url:e.url},t)}};var u=class{constructor(e){this.httpClient=e;}async sendPrivateReply(e,t){return this.httpClient.post("/api/v1/instagram/private-reply",{token:e.token,commentId:e.commentId,message:e.message},t)}async sendText(e,t){return this.httpClient.post("/api/v1/instagram/messages/text",{token:e.token,recipientId:e.recipientId,message:e.message},t)}async sendMedia(e,t){return this.httpClient.post("/api/v1/instagram/messages/media",{token:e.token,recipientId:e.recipientId,fileUrl:e.fileUrl,type:e.type,caption:e.caption},t)}async sendImages(e,t){return this.httpClient.post("/api/v1/instagram/messages/images",{token:e.token,recipientId:e.recipientId,images:e.images},t)}async sendSticker(e,t){return this.httpClient.post("/api/v1/instagram/messages/sticker",{token:e.token,recipientId:e.recipientId,stickerType:e.stickerType},t)}async reactMessage(e,t){return this.httpClient.post("/api/v1/instagram/messages/reaction",{token:e.token,messageId:e.messageId,reactionType:e.reactionType},t)}async removeReaction(e,t){return this.httpClient.delete("/api/v1/instagram/messages/reaction",t,{token:e.token,recipientId:e.recipientId,messageId:e.messageId})}async sendQuickReplies(e,t){return this.httpClient.post("/api/v1/instagram/messages/quick-replies",{token:e.token,recipientId:e.recipientId,message:e.message,quickReplies:e.quickReplies},t)}async sendGenericTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/generic-template",{token:e.token,recipientId:e.recipientId,elements:e.elements},t)}async sendButtonTemplate(e,t){return this.httpClient.post("/api/v1/instagram/messages/button-template",{token:e.token,recipientId:e.recipientId,text:e.text,buttons:e.buttons},t)}async sendSenderAction(e,t){return this.httpClient.post("/api/v1/instagram/messages/sender-action",{token:e.token,recipientId:e.recipientId,action:e.action},t)}async getUserProfile(e,t){return this.httpClient.post("/api/v1/instagram/user-profile",{token:e.token,userId:e.userId},t)}async listPosts(e,t){return this.httpClient.post("/api/v1/instagram/posts",{token:e.token,userId:e.userId,limit:e.limit},t)}async getBusinessProfile(e,t){return this.httpClient.post("/api/v1/instagram/business-profile",{token:e.token},t)}async downloadMedia(e,t){return this.httpClient.post("/api/v1/instagram/download-media",{token:e.token,url:e.url},t)}};var P=class{constructor(e){this.httpClient=new r(e),this.auth=new d(this.httpClient),this.channels=new p(this.httpClient),this.integrations=new l(this.httpClient),this.whatsapp=new c(this.httpClient),this.telegram=new h(this.httpClient),this.webchat=new g(this.httpClient),this.facebook=new m(this.httpClient),this.instagram=new u(this.httpClient);}},j=P;
|
|
7
|
+
exports.OficialAPISDK=P;exports.default=j;//# sourceMappingURL=index.js.map
|
|
8
8
|
//# sourceMappingURL=index.js.map
|