@sendly/node 3.15.2 → 3.17.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/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +35 -0
- package/dist/index.mjs +35 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -64,7 +64,7 @@ interface SendMessageRequest {
|
|
|
64
64
|
* Message status values
|
|
65
65
|
* Note: "sending" was removed as it doesn't exist in the database
|
|
66
66
|
*/
|
|
67
|
-
type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced";
|
|
67
|
+
type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced" | "retrying";
|
|
68
68
|
/**
|
|
69
69
|
* How the message was sent
|
|
70
70
|
*/
|
|
@@ -101,6 +101,14 @@ interface Message {
|
|
|
101
101
|
* Error message if status is "failed"
|
|
102
102
|
*/
|
|
103
103
|
error?: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Structured error code (e.g., "E001" for invalid number)
|
|
106
|
+
*/
|
|
107
|
+
errorCode?: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Number of retry attempts made
|
|
110
|
+
*/
|
|
111
|
+
retryCount?: number;
|
|
104
112
|
/**
|
|
105
113
|
* Number of SMS segments (1 per 160 chars)
|
|
106
114
|
*/
|
|
@@ -625,7 +633,7 @@ declare const ALL_SUPPORTED_COUNTRIES: string[];
|
|
|
625
633
|
/**
|
|
626
634
|
* Webhook event types
|
|
627
635
|
*/
|
|
628
|
-
type WebhookEventType = "message.sent" | "message.delivered" | "message.failed" | "message.bounced" | "message.queued";
|
|
636
|
+
type WebhookEventType = "message.sent" | "message.delivered" | "message.failed" | "message.bounced" | "message.retrying" | "message.queued";
|
|
629
637
|
/**
|
|
630
638
|
* Webhook mode - filters which events are delivered
|
|
631
639
|
* - "all": Receives all events (sandbox + production)
|
|
@@ -1928,6 +1936,25 @@ declare class WebhooksResource {
|
|
|
1928
1936
|
* ```
|
|
1929
1937
|
*/
|
|
1930
1938
|
test(id: string): Promise<WebhookTestResult>;
|
|
1939
|
+
/**
|
|
1940
|
+
* Reset the circuit breaker for a webhook
|
|
1941
|
+
*
|
|
1942
|
+
* Manually resets an open circuit breaker so deliveries resume immediately
|
|
1943
|
+
* instead of waiting for the automatic 5-minute recovery.
|
|
1944
|
+
*
|
|
1945
|
+
* @param id - Webhook ID
|
|
1946
|
+
* @returns Reset confirmation with updated webhook
|
|
1947
|
+
*
|
|
1948
|
+
* @example
|
|
1949
|
+
* ```typescript
|
|
1950
|
+
* const result = await sendly.webhooks.resetCircuit('whk_xxx');
|
|
1951
|
+
* console.log(result.message);
|
|
1952
|
+
* ```
|
|
1953
|
+
*/
|
|
1954
|
+
resetCircuit(id: string): Promise<{
|
|
1955
|
+
message: string;
|
|
1956
|
+
webhook: Webhook;
|
|
1957
|
+
}>;
|
|
1931
1958
|
/**
|
|
1932
1959
|
* Rotate the webhook signing secret
|
|
1933
1960
|
*
|
|
@@ -2062,6 +2089,15 @@ declare class AccountResource {
|
|
|
2062
2089
|
limit?: number;
|
|
2063
2090
|
offset?: number;
|
|
2064
2091
|
}): Promise<CreditTransaction[]>;
|
|
2092
|
+
transferCredits(options: {
|
|
2093
|
+
targetOrganizationId: string;
|
|
2094
|
+
amount: number;
|
|
2095
|
+
}): Promise<{
|
|
2096
|
+
success: boolean;
|
|
2097
|
+
amount: number;
|
|
2098
|
+
sourceBalance: number;
|
|
2099
|
+
targetBalance: number;
|
|
2100
|
+
}>;
|
|
2065
2101
|
/**
|
|
2066
2102
|
* List API keys for the account
|
|
2067
2103
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ interface SendMessageRequest {
|
|
|
64
64
|
* Message status values
|
|
65
65
|
* Note: "sending" was removed as it doesn't exist in the database
|
|
66
66
|
*/
|
|
67
|
-
type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced";
|
|
67
|
+
type MessageStatus = "queued" | "sent" | "delivered" | "failed" | "bounced" | "retrying";
|
|
68
68
|
/**
|
|
69
69
|
* How the message was sent
|
|
70
70
|
*/
|
|
@@ -101,6 +101,14 @@ interface Message {
|
|
|
101
101
|
* Error message if status is "failed"
|
|
102
102
|
*/
|
|
103
103
|
error?: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* Structured error code (e.g., "E001" for invalid number)
|
|
106
|
+
*/
|
|
107
|
+
errorCode?: string | null;
|
|
108
|
+
/**
|
|
109
|
+
* Number of retry attempts made
|
|
110
|
+
*/
|
|
111
|
+
retryCount?: number;
|
|
104
112
|
/**
|
|
105
113
|
* Number of SMS segments (1 per 160 chars)
|
|
106
114
|
*/
|
|
@@ -625,7 +633,7 @@ declare const ALL_SUPPORTED_COUNTRIES: string[];
|
|
|
625
633
|
/**
|
|
626
634
|
* Webhook event types
|
|
627
635
|
*/
|
|
628
|
-
type WebhookEventType = "message.sent" | "message.delivered" | "message.failed" | "message.bounced" | "message.queued";
|
|
636
|
+
type WebhookEventType = "message.sent" | "message.delivered" | "message.failed" | "message.bounced" | "message.retrying" | "message.queued";
|
|
629
637
|
/**
|
|
630
638
|
* Webhook mode - filters which events are delivered
|
|
631
639
|
* - "all": Receives all events (sandbox + production)
|
|
@@ -1928,6 +1936,25 @@ declare class WebhooksResource {
|
|
|
1928
1936
|
* ```
|
|
1929
1937
|
*/
|
|
1930
1938
|
test(id: string): Promise<WebhookTestResult>;
|
|
1939
|
+
/**
|
|
1940
|
+
* Reset the circuit breaker for a webhook
|
|
1941
|
+
*
|
|
1942
|
+
* Manually resets an open circuit breaker so deliveries resume immediately
|
|
1943
|
+
* instead of waiting for the automatic 5-minute recovery.
|
|
1944
|
+
*
|
|
1945
|
+
* @param id - Webhook ID
|
|
1946
|
+
* @returns Reset confirmation with updated webhook
|
|
1947
|
+
*
|
|
1948
|
+
* @example
|
|
1949
|
+
* ```typescript
|
|
1950
|
+
* const result = await sendly.webhooks.resetCircuit('whk_xxx');
|
|
1951
|
+
* console.log(result.message);
|
|
1952
|
+
* ```
|
|
1953
|
+
*/
|
|
1954
|
+
resetCircuit(id: string): Promise<{
|
|
1955
|
+
message: string;
|
|
1956
|
+
webhook: Webhook;
|
|
1957
|
+
}>;
|
|
1931
1958
|
/**
|
|
1932
1959
|
* Rotate the webhook signing secret
|
|
1933
1960
|
*
|
|
@@ -2062,6 +2089,15 @@ declare class AccountResource {
|
|
|
2062
2089
|
limit?: number;
|
|
2063
2090
|
offset?: number;
|
|
2064
2091
|
}): Promise<CreditTransaction[]>;
|
|
2092
|
+
transferCredits(options: {
|
|
2093
|
+
targetOrganizationId: string;
|
|
2094
|
+
amount: number;
|
|
2095
|
+
}): Promise<{
|
|
2096
|
+
success: boolean;
|
|
2097
|
+
amount: number;
|
|
2098
|
+
sourceBalance: number;
|
|
2099
|
+
targetBalance: number;
|
|
2100
|
+
}>;
|
|
2065
2101
|
/**
|
|
2066
2102
|
* List API keys for the account
|
|
2067
2103
|
*
|
package/dist/index.js
CHANGED
|
@@ -1246,6 +1246,31 @@ var WebhooksResource = class {
|
|
|
1246
1246
|
});
|
|
1247
1247
|
return transformKeys(response);
|
|
1248
1248
|
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Reset the circuit breaker for a webhook
|
|
1251
|
+
*
|
|
1252
|
+
* Manually resets an open circuit breaker so deliveries resume immediately
|
|
1253
|
+
* instead of waiting for the automatic 5-minute recovery.
|
|
1254
|
+
*
|
|
1255
|
+
* @param id - Webhook ID
|
|
1256
|
+
* @returns Reset confirmation with updated webhook
|
|
1257
|
+
*
|
|
1258
|
+
* @example
|
|
1259
|
+
* ```typescript
|
|
1260
|
+
* const result = await sendly.webhooks.resetCircuit('whk_xxx');
|
|
1261
|
+
* console.log(result.message);
|
|
1262
|
+
* ```
|
|
1263
|
+
*/
|
|
1264
|
+
async resetCircuit(id) {
|
|
1265
|
+
if (!id || !id.startsWith("whk_")) {
|
|
1266
|
+
throw new Error("Invalid webhook ID format");
|
|
1267
|
+
}
|
|
1268
|
+
const response = await this.http.request({
|
|
1269
|
+
method: "POST",
|
|
1270
|
+
path: `/webhooks/${encodeURIComponent(id)}/reset-circuit`
|
|
1271
|
+
});
|
|
1272
|
+
return transformKeys(response);
|
|
1273
|
+
}
|
|
1249
1274
|
/**
|
|
1250
1275
|
* Rotate the webhook signing secret
|
|
1251
1276
|
*
|
|
@@ -1414,6 +1439,16 @@ var AccountResource = class {
|
|
|
1414
1439
|
});
|
|
1415
1440
|
return transactions;
|
|
1416
1441
|
}
|
|
1442
|
+
async transferCredits(options) {
|
|
1443
|
+
return this.http.request({
|
|
1444
|
+
method: "POST",
|
|
1445
|
+
path: "/credits/transfer",
|
|
1446
|
+
body: {
|
|
1447
|
+
targetOrganizationId: options.targetOrganizationId,
|
|
1448
|
+
amount: options.amount
|
|
1449
|
+
}
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1417
1452
|
/**
|
|
1418
1453
|
* List API keys for the account
|
|
1419
1454
|
*
|
package/dist/index.mjs
CHANGED
|
@@ -1186,6 +1186,31 @@ var WebhooksResource = class {
|
|
|
1186
1186
|
});
|
|
1187
1187
|
return transformKeys(response);
|
|
1188
1188
|
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Reset the circuit breaker for a webhook
|
|
1191
|
+
*
|
|
1192
|
+
* Manually resets an open circuit breaker so deliveries resume immediately
|
|
1193
|
+
* instead of waiting for the automatic 5-minute recovery.
|
|
1194
|
+
*
|
|
1195
|
+
* @param id - Webhook ID
|
|
1196
|
+
* @returns Reset confirmation with updated webhook
|
|
1197
|
+
*
|
|
1198
|
+
* @example
|
|
1199
|
+
* ```typescript
|
|
1200
|
+
* const result = await sendly.webhooks.resetCircuit('whk_xxx');
|
|
1201
|
+
* console.log(result.message);
|
|
1202
|
+
* ```
|
|
1203
|
+
*/
|
|
1204
|
+
async resetCircuit(id) {
|
|
1205
|
+
if (!id || !id.startsWith("whk_")) {
|
|
1206
|
+
throw new Error("Invalid webhook ID format");
|
|
1207
|
+
}
|
|
1208
|
+
const response = await this.http.request({
|
|
1209
|
+
method: "POST",
|
|
1210
|
+
path: `/webhooks/${encodeURIComponent(id)}/reset-circuit`
|
|
1211
|
+
});
|
|
1212
|
+
return transformKeys(response);
|
|
1213
|
+
}
|
|
1189
1214
|
/**
|
|
1190
1215
|
* Rotate the webhook signing secret
|
|
1191
1216
|
*
|
|
@@ -1354,6 +1379,16 @@ var AccountResource = class {
|
|
|
1354
1379
|
});
|
|
1355
1380
|
return transactions;
|
|
1356
1381
|
}
|
|
1382
|
+
async transferCredits(options) {
|
|
1383
|
+
return this.http.request({
|
|
1384
|
+
method: "POST",
|
|
1385
|
+
path: "/credits/transfer",
|
|
1386
|
+
body: {
|
|
1387
|
+
targetOrganizationId: options.targetOrganizationId,
|
|
1388
|
+
amount: options.amount
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1357
1392
|
/**
|
|
1358
1393
|
* List API keys for the account
|
|
1359
1394
|
*
|