@sentdm/sentdm 0.37.0 → 0.38.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 (88) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +22 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +22 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +10 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +10 -0
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +164 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +164 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +212 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +202 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/internal/tslib.js +17 -17
  28. package/package.json +11 -1
  29. package/pagination.d.mts +3 -0
  30. package/pagination.d.mts.map +1 -0
  31. package/pagination.d.ts +3 -0
  32. package/pagination.d.ts.map +1 -0
  33. package/pagination.js +6 -0
  34. package/pagination.js.map +1 -0
  35. package/pagination.mjs +3 -0
  36. package/pagination.mjs.map +1 -0
  37. package/resources/contacts.d.mts +9 -52
  38. package/resources/contacts.d.mts.map +1 -1
  39. package/resources/contacts.d.ts +9 -52
  40. package/resources/contacts.d.ts.map +1 -1
  41. package/resources/contacts.js +8 -7
  42. package/resources/contacts.js.map +1 -1
  43. package/resources/contacts.mjs +8 -7
  44. package/resources/contacts.mjs.map +1 -1
  45. package/resources/conversations.d.mts +17 -32
  46. package/resources/conversations.d.mts.map +1 -1
  47. package/resources/conversations.d.ts +17 -32
  48. package/resources/conversations.d.ts.map +1 -1
  49. package/resources/conversations.js +17 -16
  50. package/resources/conversations.js.map +1 -1
  51. package/resources/conversations.mjs +17 -16
  52. package/resources/conversations.mjs.map +1 -1
  53. package/resources/index.d.mts +4 -4
  54. package/resources/index.d.mts.map +1 -1
  55. package/resources/index.d.ts +4 -4
  56. package/resources/index.d.ts.map +1 -1
  57. package/resources/index.js.map +1 -1
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/templates.d.mts +9 -52
  60. package/resources/templates.d.mts.map +1 -1
  61. package/resources/templates.d.ts +9 -52
  62. package/resources/templates.d.ts.map +1 -1
  63. package/resources/templates.js +8 -7
  64. package/resources/templates.js.map +1 -1
  65. package/resources/templates.mjs +8 -7
  66. package/resources/templates.mjs.map +1 -1
  67. package/resources/webhooks.d.mts +32 -117
  68. package/resources/webhooks.d.mts.map +1 -1
  69. package/resources/webhooks.d.ts +32 -117
  70. package/resources/webhooks.d.ts.map +1 -1
  71. package/resources/webhooks.js +16 -13
  72. package/resources/webhooks.js.map +1 -1
  73. package/resources/webhooks.mjs +16 -13
  74. package/resources/webhooks.mjs.map +1 -1
  75. package/src/client.ts +72 -6
  76. package/src/core/pagination.ts +428 -0
  77. package/src/index.ts +1 -0
  78. package/src/pagination.ts +2 -0
  79. package/src/resources/contacts.ts +15 -62
  80. package/src/resources/conversations.ts +36 -48
  81. package/src/resources/index.ts +5 -3
  82. package/src/resources/templates.ts +15 -62
  83. package/src/resources/webhooks.ts +61 -146
  84. package/src/version.ts +1 -1
  85. package/version.d.mts +1 -1
  86. package/version.d.ts +1 -1
  87. package/version.js +1 -1
  88. package/version.mjs +1 -1
@@ -6,13 +6,13 @@ export {
6
6
  type APIResponseOfContactMessageSummary,
7
7
  type ContactMessageSummary,
8
8
  type ContactResponse,
9
- type ContactListResponse,
10
9
  type ContactCreateParams,
11
10
  type ContactRetrieveParams,
12
11
  type ContactUpdateParams,
13
12
  type ContactListParams,
14
13
  type ContactDeleteParams,
15
14
  type ContactRetrieveMessageSummaryParams,
15
+ type ContactResponsesContactsPage,
16
16
  } from './contacts';
17
17
  export {
18
18
  Conversations,
@@ -20,6 +20,7 @@ export {
20
20
  type ConversationMessagesList,
21
21
  type ConversationListParams,
22
22
  type ConversationListMessagesParams,
23
+ type ConversationMessagesListMessagesConversationsPage,
23
24
  } from './conversations';
24
25
  export { Me, type ProfileSettings, type MeRetrieveResponse, type MeRetrieveParams } from './me';
25
26
  export {
@@ -67,12 +68,12 @@ export {
67
68
  type TemplateFooter,
68
69
  type TemplateHeader,
69
70
  type TemplateVariable,
70
- type TemplateListResponse,
71
71
  type TemplateCreateParams,
72
72
  type TemplateRetrieveParams,
73
73
  type TemplateUpdateParams,
74
74
  type TemplateListParams,
75
75
  type TemplateDeleteParams,
76
+ type TemplatesTemplatesPage,
76
77
  } from './templates';
77
78
  export {
78
79
  Users,
@@ -100,7 +101,6 @@ export {
100
101
  type TemplateEventPayload,
101
102
  type WebhookEventType,
102
103
  type WebhookResponse,
103
- type WebhookListResponse,
104
104
  type WebhookListEventTypesResponse,
105
105
  type WebhookListEventsResponse,
106
106
  type WebhookRotateSecretResponse,
@@ -115,4 +115,6 @@ export {
115
115
  type WebhookRotateSecretParams,
116
116
  type WebhookTestParams,
117
117
  type WebhookToggleStatusParams,
118
+ type WebhookResponsesWebhooksPage,
119
+ type WebhookListEventsResponsesWebhookEventsPage,
118
120
  } from './webhooks';
@@ -1,9 +1,9 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
- import * as TemplatesAPI from './templates';
5
4
  import * as WebhooksAPI from './webhooks';
6
5
  import { APIPromise } from '../core/api-promise';
6
+ import { PagePromise, TemplatesPage, type TemplatesPageParams } from '../core/pagination';
7
7
  import { buildHeaders } from '../internal/headers';
8
8
  import { RequestOptions } from '../internal/request-options';
9
9
  import { path } from '../internal/utils/path';
@@ -101,15 +101,18 @@ export class Templates extends APIResource {
101
101
  *
102
102
  * @example
103
103
  * ```ts
104
- * const templates = await client.templates.list({
105
- * page: 0,
106
- * page_size: 0,
107
- * });
104
+ * // Automatically fetches more pages as needed.
105
+ * for await (const template of client.templates.list()) {
106
+ * // ...
107
+ * }
108
108
  * ```
109
109
  */
110
- list(params: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse> {
111
- const { 'x-profile-id': xProfileID, ...query } = params;
112
- return this._client.get('/v3/templates', {
110
+ list(
111
+ params: TemplateListParams | null | undefined = {},
112
+ options?: RequestOptions,
113
+ ): PagePromise<TemplatesTemplatesPage, Template> {
114
+ const { 'x-profile-id': xProfileID, ...query } = params ?? {};
115
+ return this._client.getAPIList('/v3/templates', TemplatesPage<Template>, {
113
116
  query,
114
117
  ...options,
115
118
  headers: buildHeaders([
@@ -143,6 +146,8 @@ export class Templates extends APIResource {
143
146
  }
144
147
  }
145
148
 
149
+ export type TemplatesTemplatesPage = TemplatesPage<Template>;
150
+
146
151
  /**
147
152
  * Standard API response envelope for all v3 endpoints
148
153
  */
@@ -439,48 +444,6 @@ export namespace TemplateVariable {
439
444
  }
440
445
  }
441
446
 
442
- /**
443
- * Standard API response envelope for all v3 endpoints
444
- */
445
- export interface TemplateListResponse {
446
- /**
447
- * A paginated list of templates.
448
- */
449
- data?: TemplateListResponse.Data | null;
450
-
451
- /**
452
- * Error information
453
- */
454
- error?: WebhooksAPI.ErrorDetail | null;
455
-
456
- /**
457
- * Request and response metadata
458
- */
459
- meta?: WebhooksAPI.APIMeta;
460
-
461
- /**
462
- * Indicates whether the request was successful
463
- */
464
- success?: boolean;
465
- }
466
-
467
- export namespace TemplateListResponse {
468
- /**
469
- * A paginated list of templates.
470
- */
471
- export interface Data {
472
- /**
473
- * Pagination metadata for list responses
474
- */
475
- pagination?: WebhooksAPI.PaginationMeta;
476
-
477
- /**
478
- * The templates on this page.
479
- */
480
- templates?: Array<TemplatesAPI.Template>;
481
- }
482
- }
483
-
484
447
  export interface TemplateCreateParams {
485
448
  /**
486
449
  * Body param: Template category: MARKETING, UTILITY, AUTHENTICATION (optional,
@@ -589,17 +552,7 @@ export interface TemplateUpdateParams {
589
552
  'x-profile-id'?: string;
590
553
  }
591
554
 
592
- export interface TemplateListParams {
593
- /**
594
- * Query param: Page number (1-indexed)
595
- */
596
- page: number;
597
-
598
- /**
599
- * Query param: Number of items per page
600
- */
601
- page_size: number;
602
-
555
+ export interface TemplateListParams extends TemplatesPageParams {
603
556
  /**
604
557
  * Query param: Optional category filter: MARKETING, UTILITY, AUTHENTICATION
605
558
  */
@@ -666,7 +619,7 @@ export declare namespace Templates {
666
619
  type TemplateFooter as TemplateFooter,
667
620
  type TemplateHeader as TemplateHeader,
668
621
  type TemplateVariable as TemplateVariable,
669
- type TemplateListResponse as TemplateListResponse,
622
+ type TemplatesTemplatesPage as TemplatesTemplatesPage,
670
623
  type TemplateCreateParams as TemplateCreateParams,
671
624
  type TemplateRetrieveParams as TemplateRetrieveParams,
672
625
  type TemplateUpdateParams as TemplateUpdateParams,
@@ -3,6 +3,13 @@
3
3
  import { APIResource } from '../core/resource';
4
4
  import * as WebhooksAPI from './webhooks';
5
5
  import { APIPromise } from '../core/api-promise';
6
+ import {
7
+ PagePromise,
8
+ WebhookEventsPage,
9
+ type WebhookEventsPageParams,
10
+ WebhooksPage,
11
+ type WebhooksPageParams,
12
+ } from '../core/pagination';
6
13
  import { buildHeaders } from '../internal/headers';
7
14
  import { RequestOptions } from '../internal/request-options';
8
15
  import { path } from '../internal/utils/path';
@@ -93,15 +100,18 @@ export class Webhooks extends APIResource {
93
100
  *
94
101
  * @example
95
102
  * ```ts
96
- * const webhooks = await client.webhooks.list({
97
- * page: 0,
98
- * page_size: 0,
99
- * });
103
+ * // Automatically fetches more pages as needed.
104
+ * for await (const webhookResponse of client.webhooks.list()) {
105
+ * // ...
106
+ * }
100
107
  * ```
101
108
  */
102
- list(params: WebhookListParams, options?: RequestOptions): APIPromise<WebhookListResponse> {
103
- const { 'x-profile-id': xProfileID, ...query } = params;
104
- return this._client.get('/v3/webhooks', {
109
+ list(
110
+ params: WebhookListParams | null | undefined = {},
111
+ options?: RequestOptions,
112
+ ): PagePromise<WebhookResponsesWebhooksPage, WebhookResponse> {
113
+ const { 'x-profile-id': xProfileID, ...query } = params ?? {};
114
+ return this._client.getAPIList('/v3/webhooks', WebhooksPage<WebhookResponse>, {
105
115
  query,
106
116
  ...options,
107
117
  headers: buildHeaders([
@@ -163,26 +173,32 @@ export class Webhooks extends APIResource {
163
173
  *
164
174
  * @example
165
175
  * ```ts
166
- * const response = await client.webhooks.listEvents(
176
+ * // Automatically fetches more pages as needed.
177
+ * for await (const webhookListEventsResponse of client.webhooks.listEvents(
167
178
  * 'd4f5a6b7-c8d9-4e0f-a1b2-c3d4e5f6a7b8',
168
- * { page: 0, page_size: 0 },
169
- * );
179
+ * )) {
180
+ * // ...
181
+ * }
170
182
  * ```
171
183
  */
172
184
  listEvents(
173
185
  id: string,
174
- params: WebhookListEventsParams,
186
+ params: WebhookListEventsParams | null | undefined = {},
175
187
  options?: RequestOptions,
176
- ): APIPromise<WebhookListEventsResponse> {
177
- const { 'x-profile-id': xProfileID, ...query } = params;
178
- return this._client.get(path`/v3/webhooks/${id}/events`, {
179
- query,
180
- ...options,
181
- headers: buildHeaders([
182
- { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
183
- options?.headers,
184
- ]),
185
- });
188
+ ): PagePromise<WebhookListEventsResponsesWebhookEventsPage, WebhookListEventsResponse> {
189
+ const { 'x-profile-id': xProfileID, ...query } = params ?? {};
190
+ return this._client.getAPIList(
191
+ path`/v3/webhooks/${id}/events`,
192
+ WebhookEventsPage<WebhookListEventsResponse>,
193
+ {
194
+ query,
195
+ ...options,
196
+ headers: buildHeaders([
197
+ { ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
198
+ options?.headers,
199
+ ]),
200
+ },
201
+ );
186
202
  }
187
203
 
188
204
  /**
@@ -271,6 +287,10 @@ export class Webhooks extends APIResource {
271
287
  }
272
288
  }
273
289
 
290
+ export type WebhookResponsesWebhooksPage = WebhooksPage<WebhookResponse>;
291
+
292
+ export type WebhookListEventsResponsesWebhookEventsPage = WebhookEventsPage<WebhookListEventsResponse>;
293
+
274
294
  /**
275
295
  * Request and response metadata
276
296
  */
@@ -707,48 +727,6 @@ export interface WebhookResponse {
707
727
  updated_at?: string | null;
708
728
  }
709
729
 
710
- /**
711
- * Standard API response envelope for all v3 endpoints
712
- */
713
- export interface WebhookListResponse {
714
- /**
715
- * A paginated list of webhooks.
716
- */
717
- data?: WebhookListResponse.Data | null;
718
-
719
- /**
720
- * Error information
721
- */
722
- error?: ErrorDetail | null;
723
-
724
- /**
725
- * Request and response metadata
726
- */
727
- meta?: APIMeta;
728
-
729
- /**
730
- * Indicates whether the request was successful
731
- */
732
- success?: boolean;
733
- }
734
-
735
- export namespace WebhookListResponse {
736
- /**
737
- * A paginated list of webhooks.
738
- */
739
- export interface Data {
740
- /**
741
- * Pagination metadata for list responses
742
- */
743
- pagination?: WebhooksAPI.PaginationMeta;
744
-
745
- /**
746
- * The webhooks on this page.
747
- */
748
- webhooks?: Array<WebhooksAPI.WebhookResponse>;
749
- }
750
- }
751
-
752
730
  /**
753
731
  * Standard API response envelope for all v3 endpoints
754
732
  */
@@ -791,78 +769,34 @@ export namespace WebhookListEventTypesResponse {
791
769
  }
792
770
  }
793
771
 
794
- /**
795
- * Standard API response envelope for all v3 endpoints
796
- */
797
772
  export interface WebhookListEventsResponse {
798
- /**
799
- * A paginated list of webhook delivery records.
800
- */
801
- data?: WebhookListEventsResponse.Data | null;
773
+ id?: string;
802
774
 
803
- /**
804
- * Error information
805
- */
806
- error?: ErrorDetail | null;
775
+ created_at?: string;
807
776
 
808
- /**
809
- * Request and response metadata
810
- */
811
- meta?: APIMeta;
777
+ delivery_attempts?: number;
812
778
 
813
- /**
814
- * Indicates whether the request was successful
815
- */
816
- success?: boolean;
817
- }
779
+ delivery_status?: string;
780
+
781
+ error_message?: string | null;
818
782
 
819
- export namespace WebhookListEventsResponse {
820
783
  /**
821
- * A paginated list of webhook delivery records.
784
+ * The exact event body that was delivered, or attempted, for this record. One of
785
+ * the three webhook envelopes: a message status change, an inbound message, or a
786
+ * template status change. Read field and event to tell which, the same way your
787
+ * endpoint does.
822
788
  */
823
- export interface Data {
824
- /**
825
- * The events on this page.
826
- */
827
- events?: Array<Data.Event>;
828
-
829
- /**
830
- * Pagination metadata for list responses
831
- */
832
- pagination?: WebhooksAPI.PaginationMeta;
833
- }
834
-
835
- export namespace Data {
836
- export interface Event {
837
- id?: string;
838
-
839
- created_at?: string;
840
-
841
- delivery_attempts?: number;
842
-
843
- delivery_status?: string;
844
-
845
- error_message?: string | null;
846
-
847
- /**
848
- * The exact event body that was delivered, or attempted, for this record. One of
849
- * the three webhook envelopes: a message status change, an inbound message, or a
850
- * template status change. Read field and event to tell which, the same way your
851
- * endpoint does.
852
- */
853
- event_data?: WebhooksAPI.MessageEvent | WebhooksAPI.InboundMessageEvent | WebhooksAPI.TemplateEvent;
789
+ event_data?: MessageEvent | InboundMessageEvent | TemplateEvent;
854
790
 
855
- event_type?: string;
791
+ event_type?: string;
856
792
 
857
- http_status_code?: number | null;
793
+ http_status_code?: number | null;
858
794
 
859
- processing_completed_at?: string | null;
795
+ processing_completed_at?: string | null;
860
796
 
861
- processing_started_at?: string | null;
797
+ processing_started_at?: string | null;
862
798
 
863
- response_body?: string | null;
864
- }
865
- }
799
+ response_body?: string | null;
866
800
  }
867
801
 
868
802
  /**
@@ -1047,17 +981,7 @@ export interface WebhookUpdateParams {
1047
981
  'x-profile-id'?: string;
1048
982
  }
1049
983
 
1050
- export interface WebhookListParams {
1051
- /**
1052
- * Query param
1053
- */
1054
- page: number;
1055
-
1056
- /**
1057
- * Query param
1058
- */
1059
- page_size: number;
1060
-
984
+ export interface WebhookListParams extends WebhooksPageParams {
1061
985
  /**
1062
986
  * Query param
1063
987
  */
@@ -1092,17 +1016,7 @@ export interface WebhookListEventTypesParams {
1092
1016
  'x-profile-id'?: string;
1093
1017
  }
1094
1018
 
1095
- export interface WebhookListEventsParams {
1096
- /**
1097
- * Query param
1098
- */
1099
- page: number;
1100
-
1101
- /**
1102
- * Query param
1103
- */
1104
- page_size: number;
1105
-
1019
+ export interface WebhookListEventsParams extends WebhookEventsPageParams {
1106
1020
  /**
1107
1021
  * Query param
1108
1022
  */
@@ -1207,11 +1121,12 @@ export declare namespace Webhooks {
1207
1121
  type TemplateEventPayload as TemplateEventPayload,
1208
1122
  type WebhookEventType as WebhookEventType,
1209
1123
  type WebhookResponse as WebhookResponse,
1210
- type WebhookListResponse as WebhookListResponse,
1211
1124
  type WebhookListEventTypesResponse as WebhookListEventTypesResponse,
1212
1125
  type WebhookListEventsResponse as WebhookListEventsResponse,
1213
1126
  type WebhookRotateSecretResponse as WebhookRotateSecretResponse,
1214
1127
  type WebhookTestResponse as WebhookTestResponse,
1128
+ type WebhookResponsesWebhooksPage as WebhookResponsesWebhooksPage,
1129
+ type WebhookListEventsResponsesWebhookEventsPage as WebhookListEventsResponsesWebhookEventsPage,
1215
1130
  type WebhookCreateParams as WebhookCreateParams,
1216
1131
  type WebhookRetrieveParams as WebhookRetrieveParams,
1217
1132
  type WebhookUpdateParams as WebhookUpdateParams,
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.37.0'; // x-release-please-version
1
+ export const VERSION = '0.38.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.37.0";
1
+ export declare const VERSION = "0.38.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.37.0";
1
+ export declare const VERSION = "0.38.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.37.0'; // x-release-please-version
4
+ exports.VERSION = '0.38.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.37.0'; // x-release-please-version
1
+ export const VERSION = '0.38.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map