@zavudev/sdk 0.6.0 → 0.8.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.
Files changed (124) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/client.d.mts +17 -8
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +17 -8
  5. package/client.d.ts.map +1 -1
  6. package/client.js +11 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +11 -0
  9. package/client.mjs.map +1 -1
  10. package/core/pagination.d.mts +54 -0
  11. package/core/pagination.d.mts.map +1 -0
  12. package/core/pagination.d.ts +54 -0
  13. package/core/pagination.d.ts.map +1 -0
  14. package/core/pagination.js +101 -0
  15. package/core/pagination.js.map +1 -0
  16. package/core/pagination.mjs +95 -0
  17. package/core/pagination.mjs.map +1 -0
  18. package/index.d.mts +1 -0
  19. package/index.d.mts.map +1 -1
  20. package/index.d.ts +1 -0
  21. package/index.d.ts.map +1 -1
  22. package/index.js +3 -1
  23. package/index.js.map +1 -1
  24. package/index.mjs +1 -0
  25. package/index.mjs.map +1 -1
  26. package/package.json +11 -1
  27. package/pagination.d.mts +2 -0
  28. package/pagination.d.mts.map +1 -0
  29. package/pagination.d.ts +2 -0
  30. package/pagination.d.ts.map +1 -0
  31. package/pagination.js +6 -0
  32. package/pagination.js.map +1 -0
  33. package/pagination.mjs +2 -0
  34. package/pagination.mjs.map +1 -0
  35. package/resources/broadcasts/broadcasts.d.mts +361 -0
  36. package/resources/broadcasts/broadcasts.d.mts.map +1 -0
  37. package/resources/broadcasts/broadcasts.d.ts +361 -0
  38. package/resources/broadcasts/broadcasts.d.ts.map +1 -0
  39. package/resources/broadcasts/broadcasts.js +131 -0
  40. package/resources/broadcasts/broadcasts.js.map +1 -0
  41. package/resources/broadcasts/broadcasts.mjs +126 -0
  42. package/resources/broadcasts/broadcasts.mjs.map +1 -0
  43. package/resources/broadcasts/contacts.d.mts +120 -0
  44. package/resources/broadcasts/contacts.d.mts.map +1 -0
  45. package/resources/broadcasts/contacts.d.ts +120 -0
  46. package/resources/broadcasts/contacts.d.ts.map +1 -0
  47. package/resources/broadcasts/contacts.js +76 -0
  48. package/resources/broadcasts/contacts.js.map +1 -0
  49. package/resources/broadcasts/contacts.mjs +72 -0
  50. package/resources/broadcasts/contacts.mjs.map +1 -0
  51. package/resources/broadcasts/index.d.mts +3 -0
  52. package/resources/broadcasts/index.d.mts.map +1 -0
  53. package/resources/broadcasts/index.d.ts +3 -0
  54. package/resources/broadcasts/index.d.ts.map +1 -0
  55. package/resources/broadcasts/index.js +9 -0
  56. package/resources/broadcasts/index.js.map +1 -0
  57. package/resources/broadcasts/index.mjs +4 -0
  58. package/resources/broadcasts/index.mjs.map +1 -0
  59. package/resources/broadcasts.d.mts +2 -0
  60. package/resources/broadcasts.d.mts.map +1 -0
  61. package/resources/broadcasts.d.ts +2 -0
  62. package/resources/broadcasts.d.ts.map +1 -0
  63. package/resources/broadcasts.js +6 -0
  64. package/resources/broadcasts.js.map +1 -0
  65. package/resources/broadcasts.mjs +3 -0
  66. package/resources/broadcasts.mjs.map +1 -0
  67. package/resources/contacts.d.mts +5 -9
  68. package/resources/contacts.d.mts.map +1 -1
  69. package/resources/contacts.d.ts +5 -9
  70. package/resources/contacts.d.ts.map +1 -1
  71. package/resources/contacts.js +2 -1
  72. package/resources/contacts.js.map +1 -1
  73. package/resources/contacts.mjs +2 -1
  74. package/resources/contacts.mjs.map +1 -1
  75. package/resources/index.d.mts +5 -4
  76. package/resources/index.d.mts.map +1 -1
  77. package/resources/index.d.ts +5 -4
  78. package/resources/index.d.ts.map +1 -1
  79. package/resources/index.js +3 -1
  80. package/resources/index.js.map +1 -1
  81. package/resources/index.mjs +1 -0
  82. package/resources/index.mjs.map +1 -1
  83. package/resources/messages.d.mts +9 -10
  84. package/resources/messages.d.mts.map +1 -1
  85. package/resources/messages.d.ts +9 -10
  86. package/resources/messages.d.ts.map +1 -1
  87. package/resources/messages.js +6 -2
  88. package/resources/messages.js.map +1 -1
  89. package/resources/messages.mjs +6 -2
  90. package/resources/messages.mjs.map +1 -1
  91. package/resources/senders.d.mts +5 -9
  92. package/resources/senders.d.mts.map +1 -1
  93. package/resources/senders.d.ts +5 -9
  94. package/resources/senders.d.ts.map +1 -1
  95. package/resources/senders.js +2 -1
  96. package/resources/senders.js.map +1 -1
  97. package/resources/senders.mjs +2 -1
  98. package/resources/senders.mjs.map +1 -1
  99. package/resources/templates.d.mts +9 -10
  100. package/resources/templates.d.mts.map +1 -1
  101. package/resources/templates.d.ts +9 -10
  102. package/resources/templates.d.ts.map +1 -1
  103. package/resources/templates.js +6 -2
  104. package/resources/templates.js.map +1 -1
  105. package/resources/templates.mjs +6 -2
  106. package/resources/templates.mjs.map +1 -1
  107. package/src/client.ts +77 -8
  108. package/src/core/pagination.ts +152 -0
  109. package/src/index.ts +1 -0
  110. package/src/pagination.ts +2 -0
  111. package/src/resources/broadcasts/broadcasts.ts +519 -0
  112. package/src/resources/broadcasts/contacts.ts +160 -0
  113. package/src/resources/broadcasts/index.ts +31 -0
  114. package/src/resources/broadcasts.ts +3 -0
  115. package/src/resources/contacts.ts +7 -14
  116. package/src/resources/index.ts +26 -4
  117. package/src/resources/messages.ts +11 -15
  118. package/src/resources/senders.ts +7 -14
  119. package/src/resources/templates.ts +11 -15
  120. package/src/version.ts +1 -1
  121. package/version.d.mts +1 -1
  122. package/version.d.ts +1 -1
  123. package/version.js +1 -1
  124. package/version.mjs +1 -1
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { RequestOptions } from '../internal/request-options';
6
7
  import { path } from '../internal/utils/path';
7
8
 
@@ -26,8 +27,8 @@ export class Contacts extends APIResource {
26
27
  list(
27
28
  query: ContactListParams | null | undefined = {},
28
29
  options?: RequestOptions,
29
- ): APIPromise<ContactListResponse> {
30
- return this._client.get('/v1/contacts', { query, ...options });
30
+ ): PagePromise<ContactsCursor, Contact> {
31
+ return this._client.getAPIList('/v1/contacts', Cursor<Contact>, { query, ...options });
31
32
  }
32
33
 
33
34
  /**
@@ -38,6 +39,8 @@ export class Contacts extends APIResource {
38
39
  }
39
40
  }
40
41
 
42
+ export type ContactsCursor = Cursor<Contact>;
43
+
41
44
  export interface Contact {
42
45
  id: string;
43
46
 
@@ -70,12 +73,6 @@ export interface Contact {
70
73
  verified?: boolean;
71
74
  }
72
75
 
73
- export interface ContactListResponse {
74
- items: Array<Contact>;
75
-
76
- nextCursor?: string | null;
77
- }
78
-
79
76
  export interface ContactUpdateParams {
80
77
  /**
81
78
  * Preferred channel for this contact. Set to null to clear.
@@ -85,18 +82,14 @@ export interface ContactUpdateParams {
85
82
  metadata?: { [key: string]: string };
86
83
  }
87
84
 
88
- export interface ContactListParams {
89
- cursor?: string;
90
-
91
- limit?: number;
92
-
85
+ export interface ContactListParams extends CursorParams {
93
86
  phoneNumber?: string;
94
87
  }
95
88
 
96
89
  export declare namespace Contacts {
97
90
  export {
98
91
  type Contact as Contact,
99
- type ContactListResponse as ContactListResponse,
92
+ type ContactsCursor as ContactsCursor,
100
93
  type ContactUpdateParams as ContactUpdateParams,
101
94
  type ContactListParams as ContactListParams,
102
95
  };
@@ -1,11 +1,33 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Broadcasts,
5
+ type Broadcast,
6
+ type BroadcastChannel,
7
+ type BroadcastContact,
8
+ type BroadcastContactStatus,
9
+ type BroadcastContent,
10
+ type BroadcastMessageType,
11
+ type BroadcastProgress,
12
+ type BroadcastStatus,
13
+ type BroadcastCreateResponse,
14
+ type BroadcastRetrieveResponse,
15
+ type BroadcastUpdateResponse,
16
+ type BroadcastCancelResponse,
17
+ type BroadcastSendResponse,
18
+ type BroadcastCreateParams,
19
+ type BroadcastUpdateParams,
20
+ type BroadcastListParams,
21
+ type BroadcastSendParams,
22
+ type BroadcastContactsCursor,
23
+ type BroadcastsCursor,
24
+ } from './broadcasts/broadcasts';
3
25
  export {
4
26
  Contacts,
5
27
  type Contact,
6
- type ContactListResponse,
7
28
  type ContactUpdateParams,
8
29
  type ContactListParams,
30
+ type ContactsCursor,
9
31
  } from './contacts';
10
32
  export {
11
33
  Introspect,
@@ -21,24 +43,24 @@ export {
21
43
  type MessageResponse,
22
44
  type MessageStatus,
23
45
  type MessageType,
24
- type MessageListResponse,
25
46
  type MessageListParams,
26
47
  type MessageReactParams,
27
48
  type MessageSendParams,
49
+ type MessagesCursor,
28
50
  } from './messages';
29
51
  export {
30
52
  Senders,
31
53
  type Sender,
32
- type SenderListResponse,
33
54
  type SenderCreateParams,
34
55
  type SenderUpdateParams,
35
56
  type SenderListParams,
57
+ type SendersCursor,
36
58
  } from './senders';
37
59
  export {
38
60
  Templates,
39
61
  type Template,
40
62
  type WhatsappCategory,
41
- type TemplateListResponse,
42
63
  type TemplateCreateParams,
43
64
  type TemplateListParams,
65
+ type TemplatesCursor,
44
66
  } from './templates';
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
7
8
  import { path } from '../internal/utils/path';
@@ -26,14 +27,17 @@ export class Messages extends APIResource {
26
27
  *
27
28
  * @example
28
29
  * ```ts
29
- * const messages = await client.messages.list();
30
+ * // Automatically fetches more pages as needed.
31
+ * for await (const message of client.messages.list()) {
32
+ * // ...
33
+ * }
30
34
  * ```
31
35
  */
32
36
  list(
33
37
  query: MessageListParams | null | undefined = {},
34
38
  options?: RequestOptions,
35
- ): APIPromise<MessageListResponse> {
36
- return this._client.get('/v1/messages', { query, ...options });
39
+ ): PagePromise<MessagesCursor, Message> {
40
+ return this._client.getAPIList('/v1/messages', Cursor<Message>, { query, ...options });
37
41
  }
38
42
 
39
43
  /**
@@ -99,6 +103,8 @@ export class Messages extends APIResource {
99
103
  }
100
104
  }
101
105
 
106
+ export type MessagesCursor = Cursor<Message>;
107
+
102
108
  /**
103
109
  * Delivery channel. Use 'auto' for intelligent routing.
104
110
  */
@@ -304,22 +310,12 @@ export type MessageType =
304
310
  | 'reaction'
305
311
  | 'template';
306
312
 
307
- export interface MessageListResponse {
308
- items: Array<Message>;
309
-
310
- nextCursor?: string | null;
311
- }
312
-
313
- export interface MessageListParams {
313
+ export interface MessageListParams extends CursorParams {
314
314
  /**
315
315
  * Delivery channel. Use 'auto' for intelligent routing.
316
316
  */
317
317
  channel?: Channel;
318
318
 
319
- cursor?: string;
320
-
321
- limit?: number;
322
-
323
319
  status?: MessageStatus;
324
320
 
325
321
  to?: string;
@@ -408,7 +404,7 @@ export declare namespace Messages {
408
404
  type MessageResponse as MessageResponse,
409
405
  type MessageStatus as MessageStatus,
410
406
  type MessageType as MessageType,
411
- type MessageListResponse as MessageListResponse,
407
+ type MessagesCursor as MessagesCursor,
412
408
  type MessageListParams as MessageListParams,
413
409
  type MessageReactParams as MessageReactParams,
414
410
  type MessageSendParams as MessageSendParams,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
7
8
  import { path } from '../internal/utils/path';
@@ -34,8 +35,8 @@ export class Senders extends APIResource {
34
35
  list(
35
36
  query: SenderListParams | null | undefined = {},
36
37
  options?: RequestOptions,
37
- ): APIPromise<SenderListResponse> {
38
- return this._client.get('/v1/senders', { query, ...options });
38
+ ): PagePromise<SendersCursor, Sender> {
39
+ return this._client.getAPIList('/v1/senders', Cursor<Sender>, { query, ...options });
39
40
  }
40
41
 
41
42
  /**
@@ -49,6 +50,8 @@ export class Senders extends APIResource {
49
50
  }
50
51
  }
51
52
 
53
+ export type SendersCursor = Cursor<Sender>;
54
+
52
55
  export interface Sender {
53
56
  id: string;
54
57
 
@@ -69,12 +72,6 @@ export interface Sender {
69
72
  updatedAt?: string;
70
73
  }
71
74
 
72
- export interface SenderListResponse {
73
- items: Array<Sender>;
74
-
75
- nextCursor?: string | null;
76
- }
77
-
78
75
  export interface SenderCreateParams {
79
76
  name: string;
80
77
 
@@ -89,16 +86,12 @@ export interface SenderUpdateParams {
89
86
  setAsDefault?: boolean;
90
87
  }
91
88
 
92
- export interface SenderListParams {
93
- cursor?: string;
94
-
95
- limit?: number;
96
- }
89
+ export interface SenderListParams extends CursorParams {}
97
90
 
98
91
  export declare namespace Senders {
99
92
  export {
100
93
  type Sender as Sender,
101
- type SenderListResponse as SenderListResponse,
94
+ type SendersCursor as SendersCursor,
102
95
  type SenderCreateParams as SenderCreateParams,
103
96
  type SenderUpdateParams as SenderUpdateParams,
104
97
  type SenderListParams as SenderListParams,
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
4
  import { APIPromise } from '../core/api-promise';
5
+ import { Cursor, type CursorParams, PagePromise } from '../core/pagination';
5
6
  import { buildHeaders } from '../internal/headers';
6
7
  import { RequestOptions } from '../internal/request-options';
7
8
  import { path } from '../internal/utils/path';
@@ -45,14 +46,17 @@ export class Templates extends APIResource {
45
46
  *
46
47
  * @example
47
48
  * ```ts
48
- * const templates = await client.templates.list();
49
+ * // Automatically fetches more pages as needed.
50
+ * for await (const template of client.templates.list()) {
51
+ * // ...
52
+ * }
49
53
  * ```
50
54
  */
51
55
  list(
52
56
  query: TemplateListParams | null | undefined = {},
53
57
  options?: RequestOptions,
54
- ): APIPromise<TemplateListResponse> {
55
- return this._client.get('/v1/templates', { query, ...options });
58
+ ): PagePromise<TemplatesCursor, Template> {
59
+ return this._client.getAPIList('/v1/templates', Cursor<Template>, { query, ...options });
56
60
  }
57
61
 
58
62
  /**
@@ -71,6 +75,8 @@ export class Templates extends APIResource {
71
75
  }
72
76
  }
73
77
 
78
+ export type TemplatesCursor = Cursor<Template>;
79
+
74
80
  export interface Template {
75
81
  id: string;
76
82
 
@@ -168,12 +174,6 @@ export namespace Template {
168
174
  */
169
175
  export type WhatsappCategory = 'UTILITY' | 'MARKETING' | 'AUTHENTICATION';
170
176
 
171
- export interface TemplateListResponse {
172
- items: Array<Template>;
173
-
174
- nextCursor?: string | null;
175
- }
176
-
177
177
  export interface TemplateCreateParams {
178
178
  body: string;
179
179
 
@@ -189,17 +189,13 @@ export interface TemplateCreateParams {
189
189
  whatsappCategory?: WhatsappCategory;
190
190
  }
191
191
 
192
- export interface TemplateListParams {
193
- cursor?: string;
194
-
195
- limit?: number;
196
- }
192
+ export interface TemplateListParams extends CursorParams {}
197
193
 
198
194
  export declare namespace Templates {
199
195
  export {
200
196
  type Template as Template,
201
197
  type WhatsappCategory as WhatsappCategory,
202
- type TemplateListResponse as TemplateListResponse,
198
+ type TemplatesCursor as TemplatesCursor,
203
199
  type TemplateCreateParams as TemplateCreateParams,
204
200
  type TemplateListParams as TemplateListParams,
205
201
  };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.6.0'; // x-release-please-version
1
+ export const VERSION = '0.8.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.6.0";
1
+ export declare const VERSION = "0.8.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.6.0";
1
+ export declare const VERSION = "0.8.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.6.0'; // x-release-please-version
4
+ exports.VERSION = '0.8.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.6.0'; // x-release-please-version
1
+ export const VERSION = '0.8.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map