@zavudev/sdk 0.0.7 → 0.0.9

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 CHANGED
@@ -1,25 +1,22 @@
1
- # openapi
1
+ # Zavu TypeScript SDK
2
2
 
3
- Developer-friendly & type-safe Typescript SDK specifically catered to leverage *openapi* API.
3
+ Developer-friendly & type-safe TypeScript SDK for the Zavu multi-channel messaging API.
4
4
 
5
- [![Built by Speakeasy](https://img.shields.io/badge/Built_by-SPEAKEASY-374151?style=for-the-badge&labelColor=f3f4f6)](https://www.speakeasy.com/?utm_source=openapi&utm_campaign=typescript)
6
5
  [![License: MIT](https://img.shields.io/badge/LICENSE_//_MIT-3b5bdb?style=for-the-badge&labelColor=eff6ff)](https://opensource.org/licenses/MIT)
7
6
 
8
-
9
- <br /><br />
10
- > [!IMPORTANT]
11
- > This SDK is not yet ready for production use. To complete setup please follow the steps outlined in your [workspace](https://app.speakeasy.com/org/crubing/zavu). Delete this section before > publishing to a package manager.
12
-
13
7
  <!-- Start Summary [summary] -->
8
+
14
9
  ## Summary
15
10
 
16
11
  Zavu Messaging API: Unified multi-channel messaging API for Zavu.
17
12
 
18
13
  Supported channels:
14
+
19
15
  - **SMS**: Simple text messages
20
16
  - **WhatsApp**: Rich messaging with media, buttons, lists, and templates
21
17
 
22
18
  Design goals:
19
+
23
20
  - Simple `send()` entrypoint for developers
24
21
  - Project-level authentication via Bearer token
25
22
  - Support for all WhatsApp message types (text, image, video, audio, document, sticker, location, contact, buttons, list, reaction, template)
@@ -28,33 +25,36 @@ Design goals:
28
25
  <!-- End Summary [summary] -->
29
26
 
30
27
  <!-- Start Table of Contents [toc] -->
28
+
31
29
  ## Table of Contents
30
+
32
31
  <!-- $toc-max-depth=2 -->
33
- * [openapi](#openapi)
34
- * [SDK Installation](#sdk-installation)
35
- * [Requirements](#requirements)
36
- * [SDK Example Usage](#sdk-example-usage)
37
- * [Authentication](#authentication)
38
- * [Available Resources and Operations](#available-resources-and-operations)
39
- * [Standalone functions](#standalone-functions)
40
- * [Retries](#retries)
41
- * [Error Handling](#error-handling)
42
- * [Server Selection](#server-selection)
43
- * [Custom HTTP Client](#custom-http-client)
44
- * [Debugging](#debugging)
45
- * [Development](#development)
46
- * [Maturity](#maturity)
47
- * [Contributions](#contributions)
32
+
33
+ - [Zavu TypeScript SDK](#zavu-typescript-sdk)
34
+ - [SDK Installation](#sdk-installation)
35
+ - [Requirements](#requirements)
36
+ - [SDK Example Usage](#sdk-example-usage)
37
+ - [Authentication](#authentication)
38
+ - [Available Resources and Operations](#available-resources-and-operations)
39
+ - [Standalone functions](#standalone-functions)
40
+ - [Retries](#retries)
41
+ - [Error Handling](#error-handling)
42
+ - [Server Selection](#server-selection)
43
+ - [Custom HTTP Client](#custom-http-client)
44
+ - [Debugging](#debugging)
45
+ - [Development](#development)
46
+ - [Maturity](#maturity)
47
+ - [Contributions](#contributions)
48
48
 
49
49
  <!-- End Table of Contents [toc] -->
50
50
 
51
51
  <!-- Start SDK Installation [installation] -->
52
+
52
53
  ## SDK Installation
53
54
 
54
55
  > [!TIP]
55
56
  > To finish publishing your SDK to npm and others you must [run your first generation action](https://www.speakeasy.com/docs/github-setup#step-by-step-guide).
56
57
 
57
-
58
58
  The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
59
59
 
60
60
  ### NPM
@@ -83,15 +83,19 @@ yarn add <UNSET>
83
83
 
84
84
  > [!NOTE]
85
85
  > This package is published with CommonJS and ES Modules (ESM) support.
86
+
86
87
  <!-- End SDK Installation [installation] -->
87
88
 
88
89
  <!-- Start Requirements [requirements] -->
90
+
89
91
  ## Requirements
90
92
 
91
93
  For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
94
+
92
95
  <!-- End Requirements [requirements] -->
93
96
 
94
97
  <!-- Start SDK Example Usage [usage] -->
98
+
95
99
  ## SDK Example Usage
96
100
 
97
101
  ### Example
@@ -116,11 +120,12 @@ async function run() {
116
120
  }
117
121
 
118
122
  run();
119
-
120
123
  ```
124
+
121
125
  <!-- End SDK Example Usage [usage] -->
122
126
 
123
127
  <!-- Start Authentication [security] -->
128
+
124
129
  ## Authentication
125
130
 
126
131
  ### Per-Client Security Schemes
@@ -132,6 +137,7 @@ This SDK supports the following security scheme globally:
132
137
  | `bearerAuth` | http | HTTP Bearer |
133
138
 
134
139
  To authenticate with the API the `bearerAuth` parameter must be set when initializing the SDK client instance. For example:
140
+
135
141
  ```typescript
136
142
  import { Zavu } from "@zavudev/sdk";
137
143
 
@@ -152,11 +158,12 @@ async function run() {
152
158
  }
153
159
 
154
160
  run();
155
-
156
161
  ```
162
+
157
163
  <!-- End Authentication [security] -->
158
164
 
159
165
  <!-- Start Available Resources and Operations [operations] -->
166
+
160
167
  ## Available Resources and Operations
161
168
 
162
169
  <details open>
@@ -164,29 +171,30 @@ run();
164
171
 
165
172
  ### [Zavu SDK](docs/sdks/zavu/README.md)
166
173
 
167
- * [sendMessage](docs/sdks/zavu/README.md#sendmessage) - Send a message
168
- * [listMessages](docs/sdks/zavu/README.md#listmessages) - List messages
169
- * [getMessage](docs/sdks/zavu/README.md#getmessage) - Get message by ID
170
- * [sendReaction](docs/sdks/zavu/README.md#sendreaction) - Send reaction to message
171
- * [listTemplates](docs/sdks/zavu/README.md#listtemplates) - List templates
172
- * [createTemplate](docs/sdks/zavu/README.md#createtemplate) - Create template
173
- * [getTemplate](docs/sdks/zavu/README.md#gettemplate) - Get template
174
- * [deleteTemplate](docs/sdks/zavu/README.md#deletetemplate) - Delete template
175
- * [listSenders](docs/sdks/zavu/README.md#listsenders) - List senders
176
- * [createSender](docs/sdks/zavu/README.md#createsender) - Create sender
177
- * [getSender](docs/sdks/zavu/README.md#getsender) - Get sender
178
- * [updateSender](docs/sdks/zavu/README.md#updatesender) - Update sender
179
- * [deleteSender](docs/sdks/zavu/README.md#deletesender) - Delete sender
180
- * [listContacts](docs/sdks/zavu/README.md#listcontacts) - List contacts
181
- * [getContact](docs/sdks/zavu/README.md#getcontact) - Get contact
182
- * [updateContact](docs/sdks/zavu/README.md#updatecontact) - Update contact
183
- * [getContactByPhone](docs/sdks/zavu/README.md#getcontactbyphone) - Get contact by phone number
184
- * [introspectPhone](docs/sdks/zavu/README.md#introspectphone) - Introspect phone number
174
+ - [sendMessage](docs/sdks/zavu/README.md#sendmessage) - Send a message
175
+ - [listMessages](docs/sdks/zavu/README.md#listmessages) - List messages
176
+ - [getMessage](docs/sdks/zavu/README.md#getmessage) - Get message by ID
177
+ - [sendReaction](docs/sdks/zavu/README.md#sendreaction) - Send reaction to message
178
+ - [listTemplates](docs/sdks/zavu/README.md#listtemplates) - List templates
179
+ - [createTemplate](docs/sdks/zavu/README.md#createtemplate) - Create template
180
+ - [getTemplate](docs/sdks/zavu/README.md#gettemplate) - Get template
181
+ - [deleteTemplate](docs/sdks/zavu/README.md#deletetemplate) - Delete template
182
+ - [listSenders](docs/sdks/zavu/README.md#listsenders) - List senders
183
+ - [createSender](docs/sdks/zavu/README.md#createsender) - Create sender
184
+ - [getSender](docs/sdks/zavu/README.md#getsender) - Get sender
185
+ - [updateSender](docs/sdks/zavu/README.md#updatesender) - Update sender
186
+ - [deleteSender](docs/sdks/zavu/README.md#deletesender) - Delete sender
187
+ - [listContacts](docs/sdks/zavu/README.md#listcontacts) - List contacts
188
+ - [getContact](docs/sdks/zavu/README.md#getcontact) - Get contact
189
+ - [updateContact](docs/sdks/zavu/README.md#updatecontact) - Update contact
190
+ - [getContactByPhone](docs/sdks/zavu/README.md#getcontactbyphone) - Get contact by phone number
191
+ - [introspectPhone](docs/sdks/zavu/README.md#introspectphone) - Introspect phone number
185
192
 
186
193
  </details>
187
194
  <!-- End Available Resources and Operations [operations] -->
188
195
 
189
196
  <!-- Start Standalone functions [standalone-funcs] -->
197
+
190
198
  ## Standalone functions
191
199
 
192
200
  All the methods listed above are available as standalone functions. These
@@ -224,11 +232,13 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
224
232
  <!-- End Standalone functions [standalone-funcs] -->
225
233
 
226
234
  <!-- Start Retries [retries] -->
235
+
227
236
  ## Retries
228
237
 
229
- Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
238
+ Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
230
239
 
231
240
  To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
241
+
232
242
  ```typescript
233
243
  import { Zavu } from "@zavudev/sdk";
234
244
 
@@ -237,33 +247,36 @@ const zavu = new Zavu({
237
247
  });
238
248
 
239
249
  async function run() {
240
- const result = await zavu.sendMessage({
241
- zavuSender: "sender_12345",
242
- body: {
243
- to: "+56912345678",
244
- text: "Your verification code is 123456",
250
+ const result = await zavu.sendMessage(
251
+ {
252
+ zavuSender: "sender_12345",
253
+ body: {
254
+ to: "+56912345678",
255
+ text: "Your verification code is 123456",
256
+ },
245
257
  },
246
- }, {
247
- retries: {
248
- strategy: "backoff",
249
- backoff: {
250
- initialInterval: 1,
251
- maxInterval: 50,
252
- exponent: 1.1,
253
- maxElapsedTime: 100,
258
+ {
259
+ retries: {
260
+ strategy: "backoff",
261
+ backoff: {
262
+ initialInterval: 1,
263
+ maxInterval: 50,
264
+ exponent: 1.1,
265
+ maxElapsedTime: 100,
266
+ },
267
+ retryConnectionErrors: false,
254
268
  },
255
- retryConnectionErrors: false,
256
269
  },
257
- });
270
+ );
258
271
 
259
272
  console.log(result);
260
273
  }
261
274
 
262
275
  run();
263
-
264
276
  ```
265
277
 
266
278
  If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
279
+
267
280
  ```typescript
268
281
  import { Zavu } from "@zavudev/sdk";
269
282
 
@@ -294,11 +307,12 @@ async function run() {
294
307
  }
295
308
 
296
309
  run();
297
-
298
310
  ```
311
+
299
312
  <!-- End Retries [retries] -->
300
313
 
301
314
  <!-- Start Error Handling [errors] -->
315
+
302
316
  ## Error Handling
303
317
 
304
318
  [`SDKError`](./src/models/errors/sdkerror.ts) is the base class for all HTTP error responses. It has the following properties:
@@ -313,6 +327,7 @@ run();
313
327
  | `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
314
328
 
315
329
  ### Example
330
+
316
331
  ```typescript
317
332
  import { Zavu } from "@zavudev/sdk";
318
333
  import * as errors from "@zavudev/sdk/models/errors";
@@ -351,38 +366,42 @@ async function run() {
351
366
  }
352
367
 
353
368
  run();
354
-
355
369
  ```
356
370
 
357
371
  ### Error Classes
372
+
358
373
  **Primary errors:**
359
- * [`SDKError`](./src/models/errors/sdkerror.ts): The base class for HTTP error responses.
360
- * [`ErrorT`](./src/models/errors/errort.ts): Generic error.
374
+
375
+ - [`SDKError`](./src/models/errors/sdkerror.ts): The base class for HTTP error responses.
376
+ - [`ErrorT`](./src/models/errors/errort.ts): Generic error.
361
377
 
362
378
  <details><summary>Less common errors (6)</summary>
363
379
 
364
380
  <br />
365
381
 
366
382
  **Network errors:**
367
- * [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
368
- * [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
369
- * [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
370
- * [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
371
- * [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
372
383
 
384
+ - [`ConnectionError`](./src/models/errors/httpclienterrors.ts): HTTP client was unable to make a request to a server.
385
+ - [`RequestTimeoutError`](./src/models/errors/httpclienterrors.ts): HTTP request timed out due to an AbortSignal signal.
386
+ - [`RequestAbortedError`](./src/models/errors/httpclienterrors.ts): HTTP request was aborted by the client.
387
+ - [`InvalidRequestError`](./src/models/errors/httpclienterrors.ts): Any input used to create a request is invalid.
388
+ - [`UnexpectedClientError`](./src/models/errors/httpclienterrors.ts): Unrecognised or unexpected error.
373
389
 
374
390
  **Inherit from [`SDKError`](./src/models/errors/sdkerror.ts)**:
375
- * [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
391
+
392
+ - [`ResponseValidationError`](./src/models/errors/responsevalidationerror.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
376
393
 
377
394
  </details>
378
395
  <!-- End Error Handling [errors] -->
379
396
 
380
397
  <!-- Start Server Selection [server] -->
398
+
381
399
  ## Server Selection
382
400
 
383
401
  ### Override Server URL Per-Client
384
402
 
385
403
  The default server can be overridden globally by passing a URL to the `serverURL: string` optional parameter when initializing the SDK client instance. For example:
404
+
386
405
  ```typescript
387
406
  import { Zavu } from "@zavudev/sdk";
388
407
 
@@ -404,11 +423,12 @@ async function run() {
404
423
  }
405
424
 
406
425
  run();
407
-
408
426
  ```
427
+
409
428
  <!-- End Server Selection [server] -->
410
429
 
411
430
  <!-- Start Custom HTTP Client [http-client] -->
431
+
412
432
  ## Custom HTTP Client
413
433
 
414
434
  The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
@@ -433,12 +453,12 @@ const httpClient = new HTTPClient({
433
453
  // fetcher takes a function that has the same signature as native `fetch`.
434
454
  fetcher: (request) => {
435
455
  return fetch(request);
436
- }
456
+ },
437
457
  });
438
458
 
439
459
  httpClient.addHook("beforeRequest", (request) => {
440
460
  const nextRequest = new Request(request, {
441
- signal: request.signal || AbortSignal.timeout(5000)
461
+ signal: request.signal || AbortSignal.timeout(5000),
442
462
  });
443
463
 
444
464
  nextRequest.headers.set("x-custom-header", "custom value");
@@ -455,9 +475,11 @@ httpClient.addHook("requestError", (error, request) => {
455
475
 
456
476
  const sdk = new Zavu({ httpClient: httpClient });
457
477
  ```
478
+
458
479
  <!-- End Custom HTTP Client [http-client] -->
459
480
 
460
481
  <!-- Start Debugging [debug] -->
482
+
461
483
  ## Debugging
462
484
 
463
485
  You can setup your SDK to emit debug logs for SDK requests and responses.
@@ -472,6 +494,7 @@ import { Zavu } from "@zavudev/sdk";
472
494
 
473
495
  const sdk = new Zavu({ debugLogger: console });
474
496
  ```
497
+
475
498
  <!-- End Debugging [debug] -->
476
499
 
477
500
  <!-- Placeholder for Future Speakeasy SDK Sections -->
@@ -486,7 +509,7 @@ looking for the latest version.
486
509
 
487
510
  ## Contributions
488
511
 
489
- While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
490
- We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
512
+ While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
513
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
491
514
 
492
- ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=openapi&utm_campaign=typescript)
515
+ ### SDK Created by [Speakeasy](https://www.speakeasy.com/?utm_source=zavu&utm_campaign=typescript)
@@ -31,8 +31,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
31
31
  export declare const SDK_METADATA: {
32
32
  readonly language: "typescript";
33
33
  readonly openapiDocVersion: "0.2.0";
34
- readonly sdkVersion: "0.0.7";
34
+ readonly sdkVersion: "0.0.9";
35
35
  readonly genVersion: "2.768.1";
36
- readonly userAgent: "speakeasy-sdk/typescript 0.0.7 2.768.1 0.2.0 @zavudev/sdk";
36
+ readonly userAgent: "speakeasy-sdk/typescript 0.0.9 2.768.1 0.2.0 @zavudev/sdk";
37
37
  };
38
38
  //# sourceMappingURL=config.d.ts.map
@@ -28,8 +28,8 @@ function serverURLFromOptions(options) {
28
28
  exports.SDK_METADATA = {
29
29
  language: "typescript",
30
30
  openapiDocVersion: "0.2.0",
31
- sdkVersion: "0.0.7",
31
+ sdkVersion: "0.0.9",
32
32
  genVersion: "2.768.1",
33
- userAgent: "speakeasy-sdk/typescript 0.0.7 2.768.1 0.2.0 @zavudev/sdk",
33
+ userAgent: "speakeasy-sdk/typescript 0.0.9 2.768.1 0.2.0 @zavudev/sdk",
34
34
  };
35
35
  //# sourceMappingURL=config.js.map
@@ -31,8 +31,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
31
31
  export declare const SDK_METADATA: {
32
32
  readonly language: "typescript";
33
33
  readonly openapiDocVersion: "0.2.0";
34
- readonly sdkVersion: "0.0.7";
34
+ readonly sdkVersion: "0.0.9";
35
35
  readonly genVersion: "2.768.1";
36
- readonly userAgent: "speakeasy-sdk/typescript 0.0.7 2.768.1 0.2.0 @zavudev/sdk";
36
+ readonly userAgent: "speakeasy-sdk/typescript 0.0.9 2.768.1 0.2.0 @zavudev/sdk";
37
37
  };
38
38
  //# sourceMappingURL=config.d.ts.map
@@ -24,8 +24,8 @@ export function serverURLFromOptions(options) {
24
24
  export const SDK_METADATA = {
25
25
  language: "typescript",
26
26
  openapiDocVersion: "0.2.0",
27
- sdkVersion: "0.0.7",
27
+ sdkVersion: "0.0.9",
28
28
  genVersion: "2.768.1",
29
- userAgent: "speakeasy-sdk/typescript 0.0.7 2.768.1 0.2.0 @zavudev/sdk",
29
+ userAgent: "speakeasy-sdk/typescript 0.0.9 2.768.1 0.2.0 @zavudev/sdk",
30
30
  };
31
31
  //# sourceMappingURL=config.js.map
@@ -6,7 +6,7 @@
6
6
  "packages": {
7
7
  "..": {
8
8
  "name": "@zavudev/sdk",
9
- "version": "0.0.7",
9
+ "version": "0.0.9",
10
10
  "dependencies": {
11
11
  "zod": "^3.25.65 || ^4.0.0"
12
12
  },
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "..": {
20
20
  "name": "@zavudev/sdk",
21
- "version": "0.0.7",
21
+ "version": "0.0.9",
22
22
  "dependencies": {
23
23
  "zod": "^3.25.65 || ^4.0.0"
24
24
  },
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@zavudev/sdk",
5
- "version": "0.0.7",
5
+ "version": "0.0.9",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zavudev/sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "author": "Crubing LLC",
5
5
  "type": "module",
6
6
  "tshy": {
package/src/lib/config.ts CHANGED
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
58
58
  export const SDK_METADATA = {
59
59
  language: "typescript",
60
60
  openapiDocVersion: "0.2.0",
61
- sdkVersion: "0.0.7",
61
+ sdkVersion: "0.0.9",
62
62
  genVersion: "2.768.1",
63
- userAgent: "speakeasy-sdk/typescript 0.0.7 2.768.1 0.2.0 @zavudev/sdk",
63
+ userAgent: "speakeasy-sdk/typescript 0.0.9 2.768.1 0.2.0 @zavudev/sdk",
64
64
  } as const;