shipmail 0.1.0 → 0.1.19

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,6 +1,6 @@
1
1
  # ShipMail TypeScript SDK
2
2
 
3
- Official TypeScript SDK for the [ShipMail](https://shipmail.to) API. Zero runtime dependencies.
3
+ Official TypeScript SDK for the [ShipMail](https://shipmail.to) API. Zero runtime dependencies. Works with Node.js 18+, Bun, and Deno.
4
4
 
5
5
  ## Installation
6
6
 
@@ -38,9 +38,9 @@ import { ShipMailClient } from "shipmail";
38
38
 
39
39
  const client = new ShipMailClient({
40
40
  apiKey: "sm_live_...",
41
- baseUrl: "https://api.shipmail.to/v1", // default
42
- maxRetries: 2, // default, retries on 5xx and 429
43
- timeout: 30_000, // default, in milliseconds
41
+ baseUrl: "https://shipmail.to/api/v1", // default
42
+ maxRetries: 2, // default, retries on 5xx and 429
43
+ timeout: 30_000, // default, in milliseconds
44
44
  });
45
45
  ```
46
46
 
@@ -69,10 +69,6 @@ const mailboxes = await client.mailboxes.list({ domain_id: "dom_..." });
69
69
  const mailbox = await client.mailboxes.get("mbx_...");
70
70
  const updated = await client.mailboxes.update("mbx_...", { display_name: "New Name" });
71
71
  await client.mailboxes.delete("mbx_...");
72
-
73
- // Avatar
74
- const avatar = await client.mailboxes.uploadAvatar("mbx_...", imageBuffer, "image/png");
75
- await client.mailboxes.deleteAvatar("mbx_...");
76
72
  ```
77
73
 
78
74
  ### Messages
@@ -133,8 +129,8 @@ List methods return a paginated response with cursor-based pagination:
133
129
 
134
130
  ```typescript
135
131
  const page = await client.domains.list({ limit: 10 });
136
- console.log(page.data); // Domain[]
137
- console.log(page.pagination); // { next_cursor, has_more }
132
+ console.log(page.data); // Domain[]
133
+ console.log(page.pagination); // { next_cursor, has_more }
138
134
 
139
135
  // Fetch next page
140
136
  if (page.pagination.has_more) {
@@ -161,7 +157,7 @@ Verify incoming webhook signatures without instantiating a client:
161
157
  import { verifyWebhook, WebhookVerificationError } from "shipmail";
162
158
 
163
159
  try {
164
- const event = verifyWebhook(rawBody, request.headers, webhookSecret);
160
+ const event = await verifyWebhook(rawBody, request.headers, webhookSecret);
165
161
  console.log(event.event_type); // e.g., "message.received"
166
162
  console.log(event.data);
167
163
  } catch (err) {
@@ -192,15 +188,15 @@ try {
192
188
  await client.domains.create({ name: "" });
193
189
  } catch (err) {
194
190
  if (err instanceof ValidationError) {
195
- console.log(err.message); // Error message
196
- console.log(err.details); // Field-level validation errors
191
+ console.log(err.message); // Error message
192
+ console.log(err.details); // Field-level validation errors
197
193
  }
198
194
  if (err instanceof RateLimitError) {
199
195
  console.log(err.retryAfter); // Seconds to wait
200
196
  }
201
197
  if (err instanceof ShipMailError) {
202
- console.log(err.status); // HTTP status code
203
- console.log(err.type); // Error type string
198
+ console.log(err.status); // HTTP status code
199
+ console.log(err.type); // Error type string
204
200
  console.log(err.requestId); // Request ID for support
205
201
  console.log(err.retryable); // Whether the request can be retried
206
202
  }