@zavudev/sdk 0.8.0 → 0.9.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0 (2025-12-05)
4
+
5
+ Full Changelog: [v0.8.0...v0.9.0](https://github.com/zavudev/sdk-typescript/compare/v0.8.0...v0.9.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** fix other issues ([5752dcc](https://github.com/zavudev/sdk-typescript/commit/5752dcc208dd17fa8fd6fe6b21b0b88e666be052))
10
+
3
11
  ## 0.8.0 (2025-12-05)
4
12
 
5
13
  Full Changelog: [v0.7.0...v0.8.0](https://github.com/zavudev/sdk-typescript/compare/v0.7.0...v0.8.0)
package/README.md CHANGED
@@ -26,7 +26,7 @@ const client = new Zavudev({
26
26
  apiKey: process.env['ZAVUDEV_API_KEY'], // This is the default and can be omitted
27
27
  });
28
28
 
29
- const messageResponse = await client.messages.send({ to: '+56912345678' });
29
+ const messageResponse = await client.messages.send({ to: '+14155551234', text: 'Hello from Zavu!' });
30
30
 
31
31
  console.log(messageResponse.message);
32
32
  ```
@@ -43,7 +43,7 @@ const client = new Zavudev({
43
43
  apiKey: process.env['ZAVUDEV_API_KEY'], // This is the default and can be omitted
44
44
  });
45
45
 
46
- const params: Zavudev.MessageSendParams = { to: '+56912345678' };
46
+ const params: Zavudev.MessageSendParams = { to: '+14155551234', text: 'Hello from Zavu!' };
47
47
  const messageResponse: Zavudev.MessageResponse = await client.messages.send(params);
48
48
  ```
49
49
 
@@ -57,15 +57,17 @@ a subclass of `APIError` will be thrown:
57
57
 
58
58
  <!-- prettier-ignore -->
59
59
  ```ts
60
- const messageResponse = await client.messages.send({ to: '+56912345678' }).catch(async (err) => {
61
- if (err instanceof Zavudev.APIError) {
62
- console.log(err.status); // 400
63
- console.log(err.name); // BadRequestError
64
- console.log(err.headers); // {server: 'nginx', ...}
65
- } else {
66
- throw err;
67
- }
68
- });
60
+ const messageResponse = await client.messages
61
+ .send({ to: '+14155551234', text: 'Hello from Zavu!' })
62
+ .catch(async (err) => {
63
+ if (err instanceof Zavudev.APIError) {
64
+ console.log(err.status); // 400
65
+ console.log(err.name); // BadRequestError
66
+ console.log(err.headers); // {server: 'nginx', ...}
67
+ } else {
68
+ throw err;
69
+ }
70
+ });
69
71
  ```
70
72
 
71
73
  Error codes are as follows:
@@ -97,7 +99,7 @@ const client = new Zavudev({
97
99
  });
98
100
 
99
101
  // Or, configure per-request:
100
- await client.messages.send({ to: '+56912345678' }, {
102
+ await client.messages.send({ to: '+14155551234', text: 'Hello from Zavu!' }, {
101
103
  maxRetries: 5,
102
104
  });
103
105
  ```
@@ -114,7 +116,7 @@ const client = new Zavudev({
114
116
  });
115
117
 
116
118
  // Override per-request:
117
- await client.messages.send({ to: '+56912345678' }, {
119
+ await client.messages.send({ to: '+14155551234', text: 'Hello from Zavu!' }, {
118
120
  timeout: 5 * 1000,
119
121
  });
120
122
  ```
@@ -123,6 +125,37 @@ On timeout, an `APIConnectionTimeoutError` is thrown.
123
125
 
124
126
  Note that requests which time out will be [retried twice by default](#retries).
125
127
 
128
+ ## Auto-pagination
129
+
130
+ List methods in the Zavudev API are paginated.
131
+ You can use the `for await … of` syntax to iterate through items across all pages:
132
+
133
+ ```ts
134
+ async function fetchAllMessages(params) {
135
+ const allMessages = [];
136
+ // Automatically fetches more pages as needed.
137
+ for await (const message of client.messages.list()) {
138
+ allMessages.push(message);
139
+ }
140
+ return allMessages;
141
+ }
142
+ ```
143
+
144
+ Alternatively, you can request a single page at a time:
145
+
146
+ ```ts
147
+ let page = await client.messages.list();
148
+ for (const message of page.items) {
149
+ console.log(message);
150
+ }
151
+
152
+ // Convenience methods are provided for manually paginating:
153
+ while (page.hasNextPage()) {
154
+ page = await page.getNextPage();
155
+ // ...
156
+ }
157
+ ```
158
+
126
159
  ## Advanced Usage
127
160
 
128
161
  ### Accessing raw Response data (e.g., headers)
@@ -137,12 +170,12 @@ Unlike `.asResponse()` this method consumes the body, returning once it is parse
137
170
  ```ts
138
171
  const client = new Zavudev();
139
172
 
140
- const response = await client.messages.send({ to: '+56912345678' }).asResponse();
173
+ const response = await client.messages.send({ to: '+14155551234', text: 'Hello from Zavu!' }).asResponse();
141
174
  console.log(response.headers.get('X-My-Header'));
142
175
  console.log(response.statusText); // access the underlying Response object
143
176
 
144
177
  const { data: messageResponse, response: raw } = await client.messages
145
- .send({ to: '+56912345678' })
178
+ .send({ to: '+14155551234', text: 'Hello from Zavu!' })
146
179
  .withResponse();
147
180
  console.log(raw.headers.get('X-My-Header'));
148
181
  console.log(messageResponse.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zavudev/sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.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",
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.8.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.8.0";
1
+ export declare const VERSION = "0.9.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.8.0";
1
+ export declare const VERSION = "0.9.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.8.0'; // x-release-please-version
4
+ exports.VERSION = '0.9.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.8.0'; // x-release-please-version
1
+ export const VERSION = '0.9.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map