@botozap/sdk 0.4.0 → 0.5.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/CHANGELOG.md +21 -2
- package/README.md +19 -3
- package/dist/index.cjs +6 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +74 -78
- package/dist/index.d.ts +74 -78
- package/dist/index.js +6 -82
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5300,7 +5300,12 @@ var Broadcasts = class {
|
|
|
5300
5300
|
}
|
|
5301
5301
|
);
|
|
5302
5302
|
}
|
|
5303
|
-
/**
|
|
5303
|
+
/**
|
|
5304
|
+
* Adiciona destinatários a uma transmissão em `draft` (até 1000 por chamada).
|
|
5305
|
+
* Cada item é um objeto `{ to_recipient, components? }` — strings soltas não
|
|
5306
|
+
* são aceitas. Itens inválidos não derrubam o lote: voltam em `errors`.
|
|
5307
|
+
* Duplicatas (no lote ou já cadastradas) contam em `duplicates`.
|
|
5308
|
+
*/
|
|
5304
5309
|
addRecipients(id, recipients) {
|
|
5305
5310
|
return this.client.requestItem(
|
|
5306
5311
|
"POST",
|
|
@@ -5578,85 +5583,6 @@ function enc6(id) {
|
|
|
5578
5583
|
return encodeURIComponent(id);
|
|
5579
5584
|
}
|
|
5580
5585
|
|
|
5581
|
-
// src/resources/flows.ts
|
|
5582
|
-
var Flows = class {
|
|
5583
|
-
constructor(client) {
|
|
5584
|
-
this.client = client;
|
|
5585
|
-
}
|
|
5586
|
-
client;
|
|
5587
|
-
/**
|
|
5588
|
-
* Lista os flows de uma WABA (paginação por offset/página). Informe
|
|
5589
|
-
* `phone_number_id` OU `waba_connection_id` — a rota exige um deles.
|
|
5590
|
-
*/
|
|
5591
|
-
list(params = {}) {
|
|
5592
|
-
return this.client.requestOffsetList("GET", "/flows", {
|
|
5593
|
-
query: {
|
|
5594
|
-
page: params.page,
|
|
5595
|
-
per_page: params.per_page,
|
|
5596
|
-
phone_number_id: params.phone_number_id,
|
|
5597
|
-
waba_connection_id: params.waba_connection_id
|
|
5598
|
-
}
|
|
5599
|
-
});
|
|
5600
|
-
}
|
|
5601
|
-
get(id, params) {
|
|
5602
|
-
return this.client.requestItem("GET", `/flows/${enc7(id)}`, {
|
|
5603
|
-
query: { phone_number_id: params.phone_number_id }
|
|
5604
|
-
});
|
|
5605
|
-
}
|
|
5606
|
-
create(params) {
|
|
5607
|
-
return this.client.requestItem("POST", "/flows", { body: params });
|
|
5608
|
-
}
|
|
5609
|
-
/** Remove um flow (só DRAFT, regra da Meta). Responde 204 (sem corpo). */
|
|
5610
|
-
delete(id, params) {
|
|
5611
|
-
return this.client.request("DELETE", `/flows/${enc7(id)}`, {
|
|
5612
|
-
query: { phone_number_id: params.phone_number_id }
|
|
5613
|
-
});
|
|
5614
|
-
}
|
|
5615
|
-
publish(id, params) {
|
|
5616
|
-
return this.client.requestItem("POST", `/flows/${enc7(id)}/publish`, {
|
|
5617
|
-
body: { phone_number_id: params.phone_number_id }
|
|
5618
|
-
});
|
|
5619
|
-
}
|
|
5620
|
-
/** Lista as versões de um flow (paginação por offset/página). */
|
|
5621
|
-
listVersions(id, params = {}) {
|
|
5622
|
-
return this.client.requestOffsetList(
|
|
5623
|
-
"GET",
|
|
5624
|
-
`/flows/${enc7(id)}/versions`,
|
|
5625
|
-
{ query: { page: params.page, per_page: params.per_page } }
|
|
5626
|
-
);
|
|
5627
|
-
}
|
|
5628
|
-
createVersion(id, params) {
|
|
5629
|
-
return this.client.requestItem(
|
|
5630
|
-
"POST",
|
|
5631
|
-
`/flows/${enc7(id)}/versions`,
|
|
5632
|
-
{ body: params }
|
|
5633
|
-
);
|
|
5634
|
-
}
|
|
5635
|
-
setupEncryption(id, params) {
|
|
5636
|
-
return this.client.requestItem(
|
|
5637
|
-
"POST",
|
|
5638
|
-
`/flows/${enc7(id)}/setup_encryption`,
|
|
5639
|
-
{ body: { phone_number_id: params.phone_number_id } }
|
|
5640
|
-
);
|
|
5641
|
-
}
|
|
5642
|
-
getDataEndpoint(id) {
|
|
5643
|
-
return this.client.requestItem(
|
|
5644
|
-
"GET",
|
|
5645
|
-
`/flows/${enc7(id)}/data_endpoint`
|
|
5646
|
-
);
|
|
5647
|
-
}
|
|
5648
|
-
setDataEndpoint(id, params) {
|
|
5649
|
-
return this.client.requestItem(
|
|
5650
|
-
"POST",
|
|
5651
|
-
`/flows/${enc7(id)}/data_endpoint`,
|
|
5652
|
-
{ body: params }
|
|
5653
|
-
);
|
|
5654
|
-
}
|
|
5655
|
-
};
|
|
5656
|
-
function enc7(id) {
|
|
5657
|
-
return encodeURIComponent(id);
|
|
5658
|
-
}
|
|
5659
|
-
|
|
5660
5586
|
// src/resources/media.ts
|
|
5661
5587
|
var Media = class {
|
|
5662
5588
|
constructor(client) {
|
|
@@ -5792,7 +5718,6 @@ var BotoZap = class {
|
|
|
5792
5718
|
opportunities;
|
|
5793
5719
|
demands;
|
|
5794
5720
|
radar;
|
|
5795
|
-
flows;
|
|
5796
5721
|
media;
|
|
5797
5722
|
events;
|
|
5798
5723
|
users;
|
|
@@ -5833,7 +5758,6 @@ var BotoZap = class {
|
|
|
5833
5758
|
this.conversations = new Conversations(this);
|
|
5834
5759
|
this.webhooks = new Webhooks(this);
|
|
5835
5760
|
this.phoneNumbers = new PhoneNumbers(this);
|
|
5836
|
-
this.flows = new Flows(this);
|
|
5837
5761
|
this.media = new Media(this);
|
|
5838
5762
|
this.events = new Events(this);
|
|
5839
5763
|
this.users = new Users(this);
|