@zavudev/sdk 0.5.0 → 0.7.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 +22 -0
- package/client.d.mts +14 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +14 -8
- package/client.d.ts.map +1 -1
- package/client.js +8 -0
- package/client.js.map +1 -1
- package/client.mjs +8 -0
- package/client.mjs.map +1 -1
- package/core/pagination.d.mts +54 -0
- package/core/pagination.d.mts.map +1 -0
- package/core/pagination.d.ts +54 -0
- package/core/pagination.d.ts.map +1 -0
- package/core/pagination.js +101 -0
- package/core/pagination.js.map +1 -0
- package/core/pagination.mjs +95 -0
- package/core/pagination.mjs.map +1 -0
- package/index.d.mts +1 -0
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -0
- package/index.mjs.map +1 -1
- package/package.json +11 -1
- package/pagination.d.mts +2 -0
- package/pagination.d.mts.map +1 -0
- package/pagination.d.ts +2 -0
- package/pagination.d.ts.map +1 -0
- package/pagination.js +6 -0
- package/pagination.js.map +1 -0
- package/pagination.mjs +2 -0
- package/pagination.mjs.map +1 -0
- package/resources/contacts.d.mts +5 -9
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +5 -9
- package/resources/contacts.d.ts.map +1 -1
- package/resources/contacts.js +2 -1
- package/resources/contacts.js.map +1 -1
- package/resources/contacts.mjs +2 -1
- package/resources/contacts.mjs.map +1 -1
- package/resources/index.d.mts +4 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/messages.d.mts +16 -13
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +16 -13
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +6 -2
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +6 -2
- package/resources/messages.mjs.map +1 -1
- package/resources/senders.d.mts +5 -9
- package/resources/senders.d.mts.map +1 -1
- package/resources/senders.d.ts +5 -9
- package/resources/senders.d.ts.map +1 -1
- package/resources/senders.js +2 -1
- package/resources/senders.js.map +1 -1
- package/resources/senders.mjs +2 -1
- package/resources/senders.mjs.map +1 -1
- package/resources/templates.d.mts +9 -10
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +9 -10
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +6 -2
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +6 -2
- package/resources/templates.mjs.map +1 -1
- package/src/client.ts +32 -8
- package/src/core/pagination.ts +152 -0
- package/src/index.ts +1 -0
- package/src/pagination.ts +2 -0
- package/src/resources/contacts.ts +7 -14
- package/src/resources/index.ts +4 -4
- package/src/resources/messages.ts +19 -18
- package/src/resources/senders.ts +7 -14
- package/src/resources/templates.ts +11 -15
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var _AbstractPage_client;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.Cursor = exports.PagePromise = exports.AbstractPage = void 0;
|
|
6
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
7
|
+
const error_1 = require("./error.js");
|
|
8
|
+
const parse_1 = require("../internal/parse.js");
|
|
9
|
+
const api_promise_1 = require("./api-promise.js");
|
|
10
|
+
const values_1 = require("../internal/utils/values.js");
|
|
11
|
+
class AbstractPage {
|
|
12
|
+
constructor(client, response, body, options) {
|
|
13
|
+
_AbstractPage_client.set(this, void 0);
|
|
14
|
+
tslib_1.__classPrivateFieldSet(this, _AbstractPage_client, client, "f");
|
|
15
|
+
this.options = options;
|
|
16
|
+
this.response = response;
|
|
17
|
+
this.body = body;
|
|
18
|
+
}
|
|
19
|
+
hasNextPage() {
|
|
20
|
+
const items = this.getPaginatedItems();
|
|
21
|
+
if (!items.length)
|
|
22
|
+
return false;
|
|
23
|
+
return this.nextPageRequestOptions() != null;
|
|
24
|
+
}
|
|
25
|
+
async getNextPage() {
|
|
26
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
27
|
+
if (!nextOptions) {
|
|
28
|
+
throw new error_1.ZavudevError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
|
|
29
|
+
}
|
|
30
|
+
return await tslib_1.__classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions);
|
|
31
|
+
}
|
|
32
|
+
async *iterPages() {
|
|
33
|
+
let page = this;
|
|
34
|
+
yield page;
|
|
35
|
+
while (page.hasNextPage()) {
|
|
36
|
+
page = await page.getNextPage();
|
|
37
|
+
yield page;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() {
|
|
41
|
+
for await (const page of this.iterPages()) {
|
|
42
|
+
for (const item of page.getPaginatedItems()) {
|
|
43
|
+
yield item;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.AbstractPage = AbstractPage;
|
|
49
|
+
/**
|
|
50
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
51
|
+
*
|
|
52
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
53
|
+
*
|
|
54
|
+
* for await (const item of client.items.list()) {
|
|
55
|
+
* console.log(item)
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
class PagePromise extends api_promise_1.APIPromise {
|
|
59
|
+
constructor(client, request, Page) {
|
|
60
|
+
super(client, request, async (client, props) => new Page(client, props.response, await (0, parse_1.defaultParseResponse)(client, props), props.options));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
64
|
+
*
|
|
65
|
+
* for await (const item of client.items.list()) {
|
|
66
|
+
* console.log(item)
|
|
67
|
+
* }
|
|
68
|
+
*/
|
|
69
|
+
async *[Symbol.asyncIterator]() {
|
|
70
|
+
const page = await this;
|
|
71
|
+
for await (const item of page) {
|
|
72
|
+
yield item;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.PagePromise = PagePromise;
|
|
77
|
+
class Cursor extends AbstractPage {
|
|
78
|
+
constructor(client, response, body, options) {
|
|
79
|
+
super(client, response, body, options);
|
|
80
|
+
this.items = body.items || [];
|
|
81
|
+
this.nextCursor = body.nextCursor || '';
|
|
82
|
+
}
|
|
83
|
+
getPaginatedItems() {
|
|
84
|
+
return this.items ?? [];
|
|
85
|
+
}
|
|
86
|
+
nextPageRequestOptions() {
|
|
87
|
+
const cursor = this.nextCursor;
|
|
88
|
+
if (!cursor) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
...this.options,
|
|
93
|
+
query: {
|
|
94
|
+
...(0, values_1.maybeObj)(this.options.query),
|
|
95
|
+
cursor,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.Cursor = Cursor;
|
|
101
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;AAEtF,sCAAuC;AAEvC,gDAAyD;AAEzD,kDAA2C;AAE3C,wDAAoD;AAIpD,MAAsB,YAAY;IAOhC,YAAY,MAAe,EAAE,QAAkB,EAAE,IAAa,EAAE,OAA4B;QAN5F,uCAAiB;QAOf,+BAAA,IAAI,wBAAW,MAAM,MAAA,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,OA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by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
var _AbstractPage_client;
|
|
3
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "../internal/tslib.mjs";
|
|
4
|
+
import { ZavudevError } from "./error.mjs";
|
|
5
|
+
import { defaultParseResponse } from "../internal/parse.mjs";
|
|
6
|
+
import { APIPromise } from "./api-promise.mjs";
|
|
7
|
+
import { maybeObj } from "../internal/utils/values.mjs";
|
|
8
|
+
export class AbstractPage {
|
|
9
|
+
constructor(client, response, body, options) {
|
|
10
|
+
_AbstractPage_client.set(this, void 0);
|
|
11
|
+
__classPrivateFieldSet(this, _AbstractPage_client, client, "f");
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.response = response;
|
|
14
|
+
this.body = body;
|
|
15
|
+
}
|
|
16
|
+
hasNextPage() {
|
|
17
|
+
const items = this.getPaginatedItems();
|
|
18
|
+
if (!items.length)
|
|
19
|
+
return false;
|
|
20
|
+
return this.nextPageRequestOptions() != null;
|
|
21
|
+
}
|
|
22
|
+
async getNextPage() {
|
|
23
|
+
const nextOptions = this.nextPageRequestOptions();
|
|
24
|
+
if (!nextOptions) {
|
|
25
|
+
throw new ZavudevError('No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.');
|
|
26
|
+
}
|
|
27
|
+
return await __classPrivateFieldGet(this, _AbstractPage_client, "f").requestAPIList(this.constructor, nextOptions);
|
|
28
|
+
}
|
|
29
|
+
async *iterPages() {
|
|
30
|
+
let page = this;
|
|
31
|
+
yield page;
|
|
32
|
+
while (page.hasNextPage()) {
|
|
33
|
+
page = await page.getNextPage();
|
|
34
|
+
yield page;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async *[(_AbstractPage_client = new WeakMap(), Symbol.asyncIterator)]() {
|
|
38
|
+
for await (const page of this.iterPages()) {
|
|
39
|
+
for (const item of page.getPaginatedItems()) {
|
|
40
|
+
yield item;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* This subclass of Promise will resolve to an instantiated Page once the request completes.
|
|
47
|
+
*
|
|
48
|
+
* It also implements AsyncIterable to allow auto-paginating iteration on an unawaited list call, eg:
|
|
49
|
+
*
|
|
50
|
+
* for await (const item of client.items.list()) {
|
|
51
|
+
* console.log(item)
|
|
52
|
+
* }
|
|
53
|
+
*/
|
|
54
|
+
export class PagePromise extends APIPromise {
|
|
55
|
+
constructor(client, request, Page) {
|
|
56
|
+
super(client, request, async (client, props) => new Page(client, props.response, await defaultParseResponse(client, props), props.options));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Allow auto-paginating iteration on an unawaited list call, eg:
|
|
60
|
+
*
|
|
61
|
+
* for await (const item of client.items.list()) {
|
|
62
|
+
* console.log(item)
|
|
63
|
+
* }
|
|
64
|
+
*/
|
|
65
|
+
async *[Symbol.asyncIterator]() {
|
|
66
|
+
const page = await this;
|
|
67
|
+
for await (const item of page) {
|
|
68
|
+
yield item;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
export class Cursor extends AbstractPage {
|
|
73
|
+
constructor(client, response, body, options) {
|
|
74
|
+
super(client, response, body, options);
|
|
75
|
+
this.items = body.items || [];
|
|
76
|
+
this.nextCursor = body.nextCursor || '';
|
|
77
|
+
}
|
|
78
|
+
getPaginatedItems() {
|
|
79
|
+
return this.items ?? [];
|
|
80
|
+
}
|
|
81
|
+
nextPageRequestOptions() {
|
|
82
|
+
const cursor = this.nextCursor;
|
|
83
|
+
if (!cursor) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
...this.options,
|
|
88
|
+
query: {
|
|
89
|
+
...maybeObj(this.options.query),
|
|
90
|
+
cursor,
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=pagination.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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UAAU,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO;YACL,GAAG,IAAI,CAAC,OAAO;YACf,KAAK,EAAE;gBACL,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC/B,MAAM;aACP;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/index.d.mts
CHANGED
|
@@ -2,5 +2,6 @@ export { Zavudev as default } from "./client.mjs";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.mjs";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
4
4
|
export { Zavudev, type ClientOptions } from "./client.mjs";
|
|
5
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
5
6
|
export { ZavudevError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
6
7
|
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE;OAC/B,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE;OAC/B,EAAE,WAAW,EAAE;OACf,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export { Zavudev as default } from "./client.js";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.js";
|
|
4
4
|
export { Zavudev, type ClientOptions } from "./client.js";
|
|
5
|
+
export { PagePromise } from "./core/pagination.js";
|
|
5
6
|
export { ZavudevError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE;OAC/B,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE;OAC/B,EAAE,WAAW,EAAE;OACf,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ exports = module.exports = function (...args) {
|
|
|
4
4
|
return new exports.default(...args)
|
|
5
5
|
}
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.ZavudevError = exports.Zavudev = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
7
|
+
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.ZavudevError = exports.PagePromise = exports.Zavudev = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
8
8
|
var client_1 = require("./client.js");
|
|
9
9
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.Zavudev; } });
|
|
10
10
|
var uploads_1 = require("./core/uploads.js");
|
|
@@ -13,6 +13,8 @@ var api_promise_1 = require("./core/api-promise.js");
|
|
|
13
13
|
Object.defineProperty(exports, "APIPromise", { enumerable: true, get: function () { return api_promise_1.APIPromise; } });
|
|
14
14
|
var client_2 = require("./client.js");
|
|
15
15
|
Object.defineProperty(exports, "Zavudev", { enumerable: true, get: function () { return client_2.Zavudev; } });
|
|
16
|
+
var pagination_1 = require("./core/pagination.js");
|
|
17
|
+
Object.defineProperty(exports, "PagePromise", { enumerable: true, get: function () { return pagination_1.PagePromise; } });
|
|
16
18
|
var error_1 = require("./core/error.js");
|
|
17
19
|
Object.defineProperty(exports, "ZavudevError", { enumerable: true, get: function () { return error_1.ZavudevError; } });
|
|
18
20
|
Object.defineProperty(exports, "APIError", { enumerable: true, get: function () { return error_1.APIError; } });
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA8C;AAArC,iGAAA,OAAO,OAAW;AAE3B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAuD;AAA9C,iGAAA,OAAO,OAAA;AAChB,yCAcsB;AAbpB,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA8C;AAArC,iGAAA,OAAO,OAAW;AAE3B,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAAuD;AAA9C,iGAAA,OAAO,OAAA;AAChB,mDAAgD;AAAvC,yGAAA,WAAW,OAAA;AACpB,yCAcsB;AAbpB,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA"}
|
package/index.mjs
CHANGED
|
@@ -3,5 +3,6 @@ export { Zavudev as default } from "./client.mjs";
|
|
|
3
3
|
export { toFile } from "./core/uploads.mjs";
|
|
4
4
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
5
|
export { Zavudev } from "./client.mjs";
|
|
6
|
+
export { PagePromise } from "./core/pagination.mjs";
|
|
6
7
|
export { ZavudevError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
7
8
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAsB;OAC/B,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,IAAI,OAAO,EAAE;OAEtB,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,OAAO,EAAsB;OAC/B,EAAE,WAAW,EAAE;OACf,EACL,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,GACzB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zavudev/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "The official TypeScript library for the Zavudev API",
|
|
5
5
|
"author": "Zavudev <hi@zavu.dev>",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -75,6 +75,16 @@
|
|
|
75
75
|
"./index.mjs": {
|
|
76
76
|
"default": "./index.mjs"
|
|
77
77
|
},
|
|
78
|
+
"./pagination": {
|
|
79
|
+
"import": "./pagination.mjs",
|
|
80
|
+
"require": "./pagination.js"
|
|
81
|
+
},
|
|
82
|
+
"./pagination.js": {
|
|
83
|
+
"default": "./pagination.js"
|
|
84
|
+
},
|
|
85
|
+
"./pagination.mjs": {
|
|
86
|
+
"default": "./pagination.mjs"
|
|
87
|
+
},
|
|
78
88
|
"./resource": {
|
|
79
89
|
"import": "./resource.mjs",
|
|
80
90
|
"require": "./resource.js"
|
package/pagination.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/pagination.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/pagination.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("./internal/tslib.js");
|
|
4
|
+
/** @deprecated Import from ./core/pagination instead */
|
|
5
|
+
tslib_1.__exportStar(require("./core/pagination.js"), exports);
|
|
6
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,+DAAkC"}
|
package/pagination.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["src/pagination.ts"],"names":[],"mappings":""}
|
package/resources/contacts.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.mjs";
|
|
2
2
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.mjs";
|
|
3
4
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
5
|
export declare class Contacts extends APIResource {
|
|
5
6
|
/**
|
|
@@ -13,12 +14,13 @@ export declare class Contacts extends APIResource {
|
|
|
13
14
|
/**
|
|
14
15
|
* List contacts
|
|
15
16
|
*/
|
|
16
|
-
list(query?: ContactListParams | null | undefined, options?: RequestOptions):
|
|
17
|
+
list(query?: ContactListParams | null | undefined, options?: RequestOptions): PagePromise<ContactsCursor, Contact>;
|
|
17
18
|
/**
|
|
18
19
|
* Get contact by phone number
|
|
19
20
|
*/
|
|
20
21
|
retrieveByPhone(phoneNumber: string, options?: RequestOptions): APIPromise<Contact>;
|
|
21
22
|
}
|
|
23
|
+
export type ContactsCursor = Cursor<Contact>;
|
|
22
24
|
export interface Contact {
|
|
23
25
|
id: string;
|
|
24
26
|
/**
|
|
@@ -44,10 +46,6 @@ export interface Contact {
|
|
|
44
46
|
*/
|
|
45
47
|
verified?: boolean;
|
|
46
48
|
}
|
|
47
|
-
export interface ContactListResponse {
|
|
48
|
-
items: Array<Contact>;
|
|
49
|
-
nextCursor?: string | null;
|
|
50
|
-
}
|
|
51
49
|
export interface ContactUpdateParams {
|
|
52
50
|
/**
|
|
53
51
|
* Preferred channel for this contact. Set to null to clear.
|
|
@@ -57,12 +55,10 @@ export interface ContactUpdateParams {
|
|
|
57
55
|
[key: string]: string;
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
export interface ContactListParams {
|
|
61
|
-
cursor?: string;
|
|
62
|
-
limit?: number;
|
|
58
|
+
export interface ContactListParams extends CursorParams {
|
|
63
59
|
phoneNumber?: string;
|
|
64
60
|
}
|
|
65
61
|
export declare namespace Contacts {
|
|
66
|
-
export { type Contact as Contact, type
|
|
62
|
+
export { type Contact as Contact, type ContactsCursor as ContactsCursor, type ContactUpdateParams as ContactUpdateParams, type ContactListParams as ContactListParams, };
|
|
67
63
|
}
|
|
68
64
|
//# sourceMappingURL=contacts.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.d.mts","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAI1E;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAInG;;OAEG;IACH,IAAI,CACF,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,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AAA;KAAE,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;IAErD,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
package/resources/contacts.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.js";
|
|
2
2
|
import { APIPromise } from "../core/api-promise.js";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.js";
|
|
3
4
|
import { RequestOptions } from "../internal/request-options.js";
|
|
4
5
|
export declare class Contacts extends APIResource {
|
|
5
6
|
/**
|
|
@@ -13,12 +14,13 @@ export declare class Contacts extends APIResource {
|
|
|
13
14
|
/**
|
|
14
15
|
* List contacts
|
|
15
16
|
*/
|
|
16
|
-
list(query?: ContactListParams | null | undefined, options?: RequestOptions):
|
|
17
|
+
list(query?: ContactListParams | null | undefined, options?: RequestOptions): PagePromise<ContactsCursor, Contact>;
|
|
17
18
|
/**
|
|
18
19
|
* Get contact by phone number
|
|
19
20
|
*/
|
|
20
21
|
retrieveByPhone(phoneNumber: string, options?: RequestOptions): APIPromise<Contact>;
|
|
21
22
|
}
|
|
23
|
+
export type ContactsCursor = Cursor<Contact>;
|
|
22
24
|
export interface Contact {
|
|
23
25
|
id: string;
|
|
24
26
|
/**
|
|
@@ -44,10 +46,6 @@ export interface Contact {
|
|
|
44
46
|
*/
|
|
45
47
|
verified?: boolean;
|
|
46
48
|
}
|
|
47
|
-
export interface ContactListResponse {
|
|
48
|
-
items: Array<Contact>;
|
|
49
|
-
nextCursor?: string | null;
|
|
50
|
-
}
|
|
51
49
|
export interface ContactUpdateParams {
|
|
52
50
|
/**
|
|
53
51
|
* Preferred channel for this contact. Set to null to clear.
|
|
@@ -57,12 +55,10 @@ export interface ContactUpdateParams {
|
|
|
57
55
|
[key: string]: string;
|
|
58
56
|
};
|
|
59
57
|
}
|
|
60
|
-
export interface ContactListParams {
|
|
61
|
-
cursor?: string;
|
|
62
|
-
limit?: number;
|
|
58
|
+
export interface ContactListParams extends CursorParams {
|
|
63
59
|
phoneNumber?: string;
|
|
64
60
|
}
|
|
65
61
|
export declare namespace Contacts {
|
|
66
|
-
export { type Contact as Contact, type
|
|
62
|
+
export { type Contact as Contact, type ContactsCursor as ContactsCursor, type ContactUpdateParams as ContactUpdateParams, type ContactListParams as ContactListParams, };
|
|
67
63
|
}
|
|
68
64
|
//# sourceMappingURL=contacts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAI1E;;OAEG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAInG;;OAEG;IACH,IAAI,CAC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AE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAErC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC;IAErD,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC;AAED,MAAM,WAAW,iBAAkB,SAAQ,YAAY;IACrD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
package/resources/contacts.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.Contacts = void 0;
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const pagination_1 = require("../core/pagination.js");
|
|
6
7
|
const path_1 = require("../internal/utils/path.js");
|
|
7
8
|
class Contacts extends resource_1.APIResource {
|
|
8
9
|
/**
|
|
@@ -21,7 +22,7 @@ class Contacts extends resource_1.APIResource {
|
|
|
21
22
|
* List contacts
|
|
22
23
|
*/
|
|
23
24
|
list(query = {}, options) {
|
|
24
|
-
return this._client.
|
|
25
|
+
return this._client.getAPIList('/v1/contacts', (pagination_1.Cursor), { query, ...options });
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
27
28
|
* Get contact by phone number
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;
|
|
1
|
+
{"version":3,"file":"contacts.js","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAE5E,oDAA8C;AAE9C,MAAa,QAAS,SAAQ,sBAAW;IACvC;;OAEG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,mBAAe,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,WAAmB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,sBAAsB,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;CACF;AA/BD,4BA+BC"}
|
package/resources/contacts.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { Cursor } from "../core/pagination.mjs";
|
|
3
4
|
import { path } from "../internal/utils/path.mjs";
|
|
4
5
|
export class Contacts extends APIResource {
|
|
5
6
|
/**
|
|
@@ -18,7 +19,7 @@ export class Contacts extends APIResource {
|
|
|
18
19
|
* List contacts
|
|
19
20
|
*/
|
|
20
21
|
list(query = {}, options) {
|
|
21
|
-
return this._client.
|
|
22
|
+
return this._client.getAPIList('/v1/contacts', (Cursor), { query, ...options });
|
|
22
23
|
}
|
|
23
24
|
/**
|
|
24
25
|
* Get contact by phone number
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contacts.mjs","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;
|
|
1
|
+
{"version":3,"file":"contacts.mjs","sourceRoot":"","sources":["../src/resources/contacts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,MAAM,EAAkC;OAE1C,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;OAEG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,gBAAgB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,gBAAgB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;IAED;;OAEG;IACH,IAAI,CACF,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,EAAE,CAAA,MAAe,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;OAEG;IACH,eAAe,CAAC,WAAmB,EAAE,OAAwB;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,sBAAsB,WAAW,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;CACF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Contacts, type Contact, type
|
|
1
|
+
export { Contacts, type Contact, type ContactUpdateParams, type ContactListParams, type ContactsCursor, } from "./contacts.mjs";
|
|
2
2
|
export { Introspect, type LineType, type IntrospectValidatePhoneResponse, type IntrospectValidatePhoneParams, } from "./introspect.mjs";
|
|
3
|
-
export { Messages, type Channel, type Message, type MessageContent, type MessageResponse, type MessageStatus, type MessageType, type
|
|
4
|
-
export { Senders, type Sender, type
|
|
5
|
-
export { Templates, type Template, type WhatsappCategory, type
|
|
3
|
+
export { Messages, type Channel, type Message, type MessageContent, type MessageResponse, type MessageStatus, type MessageType, type MessageListParams, type MessageReactParams, type MessageSendParams, type MessagesCursor, } from "./messages.mjs";
|
|
4
|
+
export { Senders, type Sender, type SenderCreateParams, type SenderUpdateParams, type SenderListParams, type SendersCursor, } from "./senders.mjs";
|
|
5
|
+
export { Templates, type Template, type WhatsappCategory, type TemplateCreateParams, type TemplateListParams, type TemplatesCursor, } from "./templates.mjs";
|
|
6
6
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB;OACM,EACL,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,GACnC;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB;OACM,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB;OACM,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { Contacts, type Contact, type
|
|
1
|
+
export { Contacts, type Contact, type ContactUpdateParams, type ContactListParams, type ContactsCursor, } from "./contacts.js";
|
|
2
2
|
export { Introspect, type LineType, type IntrospectValidatePhoneResponse, type IntrospectValidatePhoneParams, } from "./introspect.js";
|
|
3
|
-
export { Messages, type Channel, type Message, type MessageContent, type MessageResponse, type MessageStatus, type MessageType, type
|
|
4
|
-
export { Senders, type Sender, type
|
|
5
|
-
export { Templates, type Template, type WhatsappCategory, type
|
|
3
|
+
export { Messages, type Channel, type Message, type MessageContent, type MessageResponse, type MessageStatus, type MessageType, type MessageListParams, type MessageReactParams, type MessageSendParams, type MessagesCursor, } from "./messages.js";
|
|
4
|
+
export { Senders, type Sender, type SenderCreateParams, type SenderUpdateParams, type SenderListParams, type SendersCursor, } from "./senders.js";
|
|
5
|
+
export { Templates, type Template, type WhatsappCategory, type TemplateCreateParams, type TemplateListParams, type TemplatesCursor, } from "./templates.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB;OACM,EACL,UAAU,EACV,KAAK,QAAQ,EACb,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,GACnC;OACM,EACL,QAAQ,EACR,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,cAAc,GACpB;OACM,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB;OACM,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,eAAe,GACrB"}
|
package/resources/messages.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.mjs";
|
|
2
2
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
3
|
+
import { Cursor, type CursorParams, PagePromise } from "../core/pagination.mjs";
|
|
3
4
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
4
5
|
export declare class Messages extends APIResource {
|
|
5
6
|
/**
|
|
@@ -18,10 +19,13 @@ export declare class Messages extends APIResource {
|
|
|
18
19
|
*
|
|
19
20
|
* @example
|
|
20
21
|
* ```ts
|
|
21
|
-
*
|
|
22
|
+
* // Automatically fetches more pages as needed.
|
|
23
|
+
* for await (const message of client.messages.list()) {
|
|
24
|
+
* // ...
|
|
25
|
+
* }
|
|
22
26
|
* ```
|
|
23
27
|
*/
|
|
24
|
-
list(query?: MessageListParams | null | undefined, options?: RequestOptions):
|
|
28
|
+
list(query?: MessageListParams | null | undefined, options?: RequestOptions): PagePromise<MessagesCursor, Message>;
|
|
25
29
|
/**
|
|
26
30
|
* Send an emoji reaction to an existing WhatsApp message. Reactions are only
|
|
27
31
|
* supported for WhatsApp messages.
|
|
@@ -59,6 +63,7 @@ export declare class Messages extends APIResource {
|
|
|
59
63
|
*/
|
|
60
64
|
send(params: MessageSendParams, options?: RequestOptions): APIPromise<MessageResponse>;
|
|
61
65
|
}
|
|
66
|
+
export type MessagesCursor = Cursor<Message>;
|
|
62
67
|
/**
|
|
63
68
|
* Delivery channel. Use 'auto' for intelligent routing.
|
|
64
69
|
*/
|
|
@@ -81,13 +86,17 @@ export interface Message {
|
|
|
81
86
|
*/
|
|
82
87
|
content?: MessageContent;
|
|
83
88
|
/**
|
|
84
|
-
*
|
|
89
|
+
* MAU cost in USD (charged for first contact of the month).
|
|
85
90
|
*/
|
|
86
91
|
cost?: number | null;
|
|
87
92
|
/**
|
|
88
|
-
* Provider
|
|
93
|
+
* Provider cost in USD (Telnyx, SES, etc.).
|
|
89
94
|
*/
|
|
90
|
-
costProvider?:
|
|
95
|
+
costProvider?: number | null;
|
|
96
|
+
/**
|
|
97
|
+
* Total cost in USD (MAU + provider cost).
|
|
98
|
+
*/
|
|
99
|
+
costTotal?: number | null;
|
|
91
100
|
errorCode?: string | null;
|
|
92
101
|
errorMessage?: string | null;
|
|
93
102
|
from?: string;
|
|
@@ -205,17 +214,11 @@ export type MessageStatus = 'queued' | 'sending' | 'delivered' | 'failed' | 'rec
|
|
|
205
214
|
* Type of message. Non-text types are WhatsApp only.
|
|
206
215
|
*/
|
|
207
216
|
export type MessageType = 'text' | 'image' | 'video' | 'audio' | 'document' | 'sticker' | 'location' | 'contact' | 'buttons' | 'list' | 'reaction' | 'template';
|
|
208
|
-
export interface
|
|
209
|
-
items: Array<Message>;
|
|
210
|
-
nextCursor?: string | null;
|
|
211
|
-
}
|
|
212
|
-
export interface MessageListParams {
|
|
217
|
+
export interface MessageListParams extends CursorParams {
|
|
213
218
|
/**
|
|
214
219
|
* Delivery channel. Use 'auto' for intelligent routing.
|
|
215
220
|
*/
|
|
216
221
|
channel?: Channel;
|
|
217
|
-
cursor?: string;
|
|
218
|
-
limit?: number;
|
|
219
222
|
status?: MessageStatus;
|
|
220
223
|
to?: string;
|
|
221
224
|
}
|
|
@@ -284,6 +287,6 @@ export interface MessageSendParams {
|
|
|
284
287
|
'Zavu-Sender'?: string;
|
|
285
288
|
}
|
|
286
289
|
export declare namespace Messages {
|
|
287
|
-
export { type Channel as Channel, type Message as Message, type MessageContent as MessageContent, type MessageResponse as MessageResponse, type MessageStatus as MessageStatus, type MessageType as MessageType, type
|
|
290
|
+
export { type Channel as Channel, type Message as Message, type MessageContent as MessageContent, type MessageResponse as MessageResponse, type MessageStatus as MessageStatus, type MessageType as MessageType, type MessagesCursor as MessagesCursor, type MessageListParams as MessageListParams, type MessageReactParams as MessageReactParams, type MessageSendParams as MessageSendParams, };
|
|
288
291
|
}
|
|
289
292
|
//# sourceMappingURL=messages.d.mts.map
|