@sentdm/sentdm 0.7.2 → 0.15.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 (161) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/README.md +71 -34
  3. package/client.d.mts +49 -21
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +49 -21
  6. package/client.d.ts.map +1 -1
  7. package/client.js +52 -38
  8. package/client.js.map +1 -1
  9. package/client.mjs +52 -38
  10. package/client.mjs.map +1 -1
  11. package/internal/tslib.js +17 -17
  12. package/internal/utils/log.d.mts.map +1 -1
  13. package/internal/utils/log.d.ts.map +1 -1
  14. package/internal/utils/log.js +0 -1
  15. package/internal/utils/log.js.map +1 -1
  16. package/internal/utils/log.mjs +0 -1
  17. package/internal/utils/log.mjs.map +1 -1
  18. package/internal/utils/query.d.mts +5 -0
  19. package/internal/utils/query.d.mts.map +1 -0
  20. package/internal/utils/query.d.ts +5 -0
  21. package/internal/utils/query.d.ts.map +1 -0
  22. package/internal/utils/query.js +23 -0
  23. package/internal/utils/query.js.map +1 -0
  24. package/internal/utils/query.mjs +20 -0
  25. package/internal/utils/query.mjs.map +1 -0
  26. package/internal/utils.d.mts +1 -0
  27. package/internal/utils.d.ts +1 -0
  28. package/internal/utils.js +1 -0
  29. package/internal/utils.js.map +1 -1
  30. package/internal/utils.mjs +1 -0
  31. package/package.json +7 -1
  32. package/resources/contacts.d.mts +243 -49
  33. package/resources/contacts.d.mts.map +1 -1
  34. package/resources/contacts.d.ts +243 -49
  35. package/resources/contacts.d.ts.map +1 -1
  36. package/resources/contacts.js +112 -15
  37. package/resources/contacts.js.map +1 -1
  38. package/resources/contacts.mjs +112 -15
  39. package/resources/contacts.mjs.map +1 -1
  40. package/resources/index.d.mts +8 -4
  41. package/resources/index.d.mts.map +1 -1
  42. package/resources/index.d.ts +8 -4
  43. package/resources/index.d.ts.map +1 -1
  44. package/resources/index.js +11 -3
  45. package/resources/index.js.map +1 -1
  46. package/resources/index.mjs +5 -1
  47. package/resources/index.mjs.map +1 -1
  48. package/resources/me.d.mts +269 -0
  49. package/resources/me.d.mts.map +1 -0
  50. package/resources/me.d.ts +269 -0
  51. package/resources/me.d.ts.map +1 -0
  52. package/resources/me.js +40 -0
  53. package/resources/me.js.map +1 -0
  54. package/resources/me.mjs +36 -0
  55. package/resources/me.mjs.map +1 -0
  56. package/resources/messages.d.mts +239 -133
  57. package/resources/messages.d.mts.map +1 -1
  58. package/resources/messages.d.ts +239 -133
  59. package/resources/messages.d.ts.map +1 -1
  60. package/resources/messages.js +42 -50
  61. package/resources/messages.js.map +1 -1
  62. package/resources/messages.mjs +42 -50
  63. package/resources/messages.mjs.map +1 -1
  64. package/resources/numbers.d.mts +70 -0
  65. package/resources/numbers.d.mts.map +1 -0
  66. package/resources/numbers.d.ts +70 -0
  67. package/resources/numbers.d.ts.map +1 -0
  68. package/resources/numbers.js +36 -0
  69. package/resources/numbers.js.map +1 -0
  70. package/resources/numbers.mjs +32 -0
  71. package/resources/numbers.mjs.map +1 -0
  72. package/resources/profiles/campaigns.d.mts +339 -0
  73. package/resources/profiles/campaigns.d.mts.map +1 -0
  74. package/resources/profiles/campaigns.d.ts +339 -0
  75. package/resources/profiles/campaigns.d.ts.map +1 -0
  76. package/resources/profiles/campaigns.js +148 -0
  77. package/resources/profiles/campaigns.js.map +1 -0
  78. package/resources/profiles/campaigns.mjs +144 -0
  79. package/resources/profiles/campaigns.mjs.map +1 -0
  80. package/resources/profiles/index.d.mts +3 -0
  81. package/resources/profiles/index.d.mts.map +1 -0
  82. package/resources/profiles/index.d.ts +3 -0
  83. package/resources/profiles/index.d.ts.map +1 -0
  84. package/resources/profiles/index.js +9 -0
  85. package/resources/profiles/index.js.map +1 -0
  86. package/resources/profiles/index.mjs +4 -0
  87. package/resources/profiles/index.mjs.map +1 -0
  88. package/resources/profiles/profiles.d.mts +967 -0
  89. package/resources/profiles/profiles.d.mts.map +1 -0
  90. package/resources/profiles/profiles.d.ts +967 -0
  91. package/resources/profiles/profiles.d.ts.map +1 -0
  92. package/resources/profiles/profiles.js +227 -0
  93. package/resources/profiles/profiles.js.map +1 -0
  94. package/resources/profiles/profiles.mjs +222 -0
  95. package/resources/profiles/profiles.mjs.map +1 -0
  96. package/resources/profiles.d.mts +2 -0
  97. package/resources/profiles.d.mts.map +1 -0
  98. package/resources/profiles.d.ts +2 -0
  99. package/resources/profiles.d.ts.map +1 -0
  100. package/resources/profiles.js +6 -0
  101. package/resources/profiles.js.map +1 -0
  102. package/resources/profiles.mjs +3 -0
  103. package/resources/profiles.mjs.map +1 -0
  104. package/resources/templates.d.mts +327 -191
  105. package/resources/templates.d.mts.map +1 -1
  106. package/resources/templates.d.ts +327 -191
  107. package/resources/templates.d.ts.map +1 -1
  108. package/resources/templates.js +80 -35
  109. package/resources/templates.js.map +1 -1
  110. package/resources/templates.mjs +80 -35
  111. package/resources/templates.mjs.map +1 -1
  112. package/resources/users.d.mts +251 -0
  113. package/resources/users.d.mts.map +1 -0
  114. package/resources/users.d.ts +251 -0
  115. package/resources/users.d.ts.map +1 -0
  116. package/resources/users.js +124 -0
  117. package/resources/users.js.map +1 -0
  118. package/resources/users.mjs +120 -0
  119. package/resources/users.mjs.map +1 -0
  120. package/resources/webhooks.d.mts +639 -0
  121. package/resources/webhooks.d.mts.map +1 -0
  122. package/resources/webhooks.d.ts +639 -0
  123. package/resources/webhooks.d.ts.map +1 -0
  124. package/resources/webhooks.js +237 -0
  125. package/resources/webhooks.js.map +1 -0
  126. package/resources/webhooks.mjs +233 -0
  127. package/resources/webhooks.mjs.map +1 -0
  128. package/src/client.ts +228 -80
  129. package/src/internal/utils/log.ts +0 -1
  130. package/src/internal/utils/query.ts +23 -0
  131. package/src/internal/utils.ts +1 -0
  132. package/src/resources/contacts.ts +335 -57
  133. package/src/resources/index.ts +81 -12
  134. package/src/resources/me.ts +333 -0
  135. package/src/resources/messages.ts +306 -147
  136. package/src/resources/numbers.ts +102 -0
  137. package/src/resources/profiles/campaigns.ts +501 -0
  138. package/src/resources/profiles/index.ts +38 -0
  139. package/src/resources/profiles/profiles.ts +1302 -0
  140. package/src/resources/profiles.ts +3 -0
  141. package/src/resources/templates.ts +424 -202
  142. package/src/resources/users.ts +366 -0
  143. package/src/resources/webhooks.ts +923 -0
  144. package/src/version.ts +1 -1
  145. package/version.d.mts +1 -1
  146. package/version.d.mts.map +1 -1
  147. package/version.d.ts +1 -1
  148. package/version.d.ts.map +1 -1
  149. package/version.js +1 -1
  150. package/version.js.map +1 -1
  151. package/version.mjs +1 -1
  152. package/version.mjs.map +1 -1
  153. package/resources/number-lookup.d.mts +0 -59
  154. package/resources/number-lookup.d.mts.map +0 -1
  155. package/resources/number-lookup.d.ts +0 -59
  156. package/resources/number-lookup.d.ts.map +0 -1
  157. package/resources/number-lookup.js +0 -17
  158. package/resources/number-lookup.js.map +0 -1
  159. package/resources/number-lookup.mjs +0 -13
  160. package/resources/number-lookup.mjs.map +0 -1
  161. package/src/resources/number-lookup.ts +0 -80
package/src/client.ts CHANGED
@@ -11,41 +11,111 @@ import type { APIResponseProps } from './internal/parse';
11
11
  import { getPlatformHeaders } from './internal/detect-platform';
12
12
  import * as Shims from './internal/shims';
13
13
  import * as Opts from './internal/request-options';
14
+ import { stringifyQuery } from './internal/utils/query';
14
15
  import { VERSION } from './version';
15
16
  import * as Errors from './core/error';
16
17
  import * as Uploads from './core/uploads';
17
18
  import * as API from './resources/index';
18
19
  import { APIPromise } from './core/api-promise';
19
20
  import {
20
- ContactListItem,
21
+ APIResponseOfContact,
22
+ ContactCreateParams,
23
+ ContactDeleteParams,
21
24
  ContactListParams,
22
25
  ContactListResponse,
23
- ContactRetrieveByPhoneParams,
24
- ContactRetrieveIDParams,
26
+ ContactResponse,
27
+ ContactRetrieveParams,
28
+ ContactUpdateParams,
25
29
  Contacts,
26
30
  } from './resources/contacts';
31
+ import { Me, MeRetrieveParams, MeRetrieveResponse, ProfileSettings } from './resources/me';
27
32
  import {
28
- MessageRetrieveResponse,
29
- MessageSendQuickMessageParams,
30
- MessageSendToContactParams,
31
- MessageSendToPhoneParams,
33
+ MessageRetrieveActivitiesParams,
34
+ MessageRetrieveActivitiesResponse,
35
+ MessageRetrieveStatusParams,
36
+ MessageRetrieveStatusResponse,
37
+ MessageSendParams,
38
+ MessageSendResponse,
32
39
  Messages,
33
40
  } from './resources/messages';
41
+ import { NumberLookupParams, NumberLookupResponse, Numbers } from './resources/numbers';
34
42
  import {
35
- NumberLookup,
36
- NumberLookupRetrieveParams,
37
- NumberLookupRetrieveResponse,
38
- } from './resources/number-lookup';
39
- import {
43
+ APIResponseTemplate,
44
+ SentDmServicesCommonContractsPocOsAuthenticationConfig,
45
+ SentDmServicesCommonContractsPocOsTemplateBody,
46
+ SentDmServicesCommonContractsPocOsTemplateButton,
47
+ SentDmServicesCommonContractsPocOsTemplateButtonProps,
48
+ SentDmServicesCommonContractsPocOsTemplateFooter,
49
+ SentDmServicesCommonContractsPocOsTemplateHeader,
50
+ Template,
40
51
  TemplateBodyContent,
41
52
  TemplateCreateParams,
42
53
  TemplateDefinition,
54
+ TemplateDeleteParams,
43
55
  TemplateListParams,
44
56
  TemplateListResponse,
45
- TemplateResponseV2,
57
+ TemplateRetrieveParams,
58
+ TemplateUpdateParams,
46
59
  TemplateVariable,
47
60
  Templates,
48
61
  } from './resources/templates';
62
+ import {
63
+ APIResponseOfUser,
64
+ UserInviteParams,
65
+ UserListParams,
66
+ UserListResponse,
67
+ UserRemoveParams,
68
+ UserResponse,
69
+ UserRetrieveParams,
70
+ UserUpdateRoleParams,
71
+ Users,
72
+ } from './resources/users';
73
+ import {
74
+ APIMeta,
75
+ APIResponseWebhook,
76
+ ErrorDetail,
77
+ MutationRequest,
78
+ PaginationMeta,
79
+ WebhookCreateParams,
80
+ WebhookDeleteParams,
81
+ WebhookListEventTypesParams,
82
+ WebhookListEventTypesResponse,
83
+ WebhookListEventsParams,
84
+ WebhookListEventsResponse,
85
+ WebhookListParams,
86
+ WebhookListResponse,
87
+ WebhookResponse,
88
+ WebhookRetrieveParams,
89
+ WebhookRotateSecretParams,
90
+ WebhookRotateSecretResponse,
91
+ WebhookTestParams,
92
+ WebhookTestResponse,
93
+ WebhookToggleStatusParams,
94
+ WebhookUpdateParams,
95
+ Webhooks,
96
+ } from './resources/webhooks';
97
+ import {
98
+ APIResponseOfProfileDetail,
99
+ BillingContactInfo,
100
+ BrandsBrandData,
101
+ DestinationCountry,
102
+ PaymentDetails,
103
+ ProfileCompleteParams,
104
+ ProfileCompleteResponse,
105
+ ProfileCreateParams,
106
+ ProfileDeleteParams,
107
+ ProfileDetail,
108
+ ProfileListParams,
109
+ ProfileListResponse,
110
+ ProfileRetrieveParams,
111
+ ProfileUpdateParams,
112
+ Profiles,
113
+ SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
114
+ SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
115
+ SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
116
+ TcrBrandRelationship,
117
+ TcrVertical,
118
+ } from './resources/profiles/profiles';
49
119
  import { type Fetch } from './internal/builtin-types';
50
120
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
51
121
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -65,11 +135,6 @@ export interface ClientOptions {
65
135
  */
66
136
  apiKey?: string | undefined;
67
137
 
68
- /**
69
- * Customer sender ID (UUID) identifying the customer account. Obtain this from your account settings. Pass via the `x-sender-id` header.
70
- */
71
- senderID?: string | undefined;
72
-
73
138
  /**
74
139
  * Override the default base URL for the API, e.g., "https://api.example.com/v2/"
75
140
  *
@@ -144,7 +209,6 @@ export interface ClientOptions {
144
209
  */
145
210
  export class SentDm {
146
211
  apiKey: string;
147
- senderID: string;
148
212
 
149
213
  baseURL: string;
150
214
  maxRetries: number;
@@ -162,7 +226,6 @@ export class SentDm {
162
226
  * API Client for interfacing with the Sent Dm API.
163
227
  *
164
228
  * @param {string | undefined} [opts.apiKey=process.env['SENT_DM_API_KEY'] ?? undefined]
165
- * @param {string | undefined} [opts.senderID=process.env['SENT_DM_SENDER_ID'] ?? undefined]
166
229
  * @param {string} [opts.baseURL=process.env['SENT_DM_BASE_URL'] ?? https://api.sent.dm] - Override the default base URL for the API.
167
230
  * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
168
231
  * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -174,7 +237,6 @@ export class SentDm {
174
237
  constructor({
175
238
  baseURL = readEnv('SENT_DM_BASE_URL'),
176
239
  apiKey = readEnv('SENT_DM_API_KEY'),
177
- senderID = readEnv('SENT_DM_SENDER_ID'),
178
240
  ...opts
179
241
  }: ClientOptions = {}) {
180
242
  if (apiKey === undefined) {
@@ -182,15 +244,9 @@ export class SentDm {
182
244
  "The SENT_DM_API_KEY environment variable is missing or empty; either provide it, or instantiate the SentDm client with an apiKey option, like new SentDm({ apiKey: 'My API Key' }).",
183
245
  );
184
246
  }
185
- if (senderID === undefined) {
186
- throw new Errors.SentDmError(
187
- "The SENT_DM_SENDER_ID environment variable is missing or empty; either provide it, or instantiate the SentDm client with an senderID option, like new SentDm({ senderID: 'My Sender ID' }).",
188
- );
189
- }
190
247
 
191
248
  const options: ClientOptions = {
192
249
  apiKey,
193
- senderID,
194
250
  ...opts,
195
251
  baseURL: baseURL || `https://api.sent.dm`,
196
252
  };
@@ -213,7 +269,6 @@ export class SentDm {
213
269
  this._options = options;
214
270
 
215
271
  this.apiKey = apiKey;
216
- this.senderID = senderID;
217
272
  }
218
273
 
219
274
  /**
@@ -230,7 +285,6 @@ export class SentDm {
230
285
  fetch: this.fetch,
231
286
  fetchOptions: this.fetchOptions,
232
287
  apiKey: this.apiKey,
233
- senderID: this.senderID,
234
288
  ...options,
235
289
  });
236
290
  return client;
@@ -252,35 +306,14 @@ export class SentDm {
252
306
  }
253
307
 
254
308
  protected async authHeaders(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
255
- return buildHeaders([await this.customerAPIKeyAuth(opts), await this.customerSenderIDAuth(opts)]);
256
- }
257
-
258
- protected async customerAPIKeyAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
259
309
  return buildHeaders([{ 'x-api-key': this.apiKey }]);
260
310
  }
261
311
 
262
- protected async customerSenderIDAuth(opts: FinalRequestOptions): Promise<NullableHeaders | undefined> {
263
- return buildHeaders([{ 'x-sender-id': this.senderID }]);
264
- }
265
-
266
312
  /**
267
313
  * Basic re-implementation of `qs.stringify` for primitive types.
268
314
  */
269
- protected stringifyQuery(query: Record<string, unknown>): string {
270
- return Object.entries(query)
271
- .filter(([_, value]) => typeof value !== 'undefined')
272
- .map(([key, value]) => {
273
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
274
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
275
- }
276
- if (value === null) {
277
- return `${encodeURIComponent(key)}=`;
278
- }
279
- throw new Errors.SentDmError(
280
- `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
281
- );
282
- })
283
- .join('&');
315
+ protected stringifyQuery(query: object | Record<string, unknown>): string {
316
+ return stringifyQuery(query);
284
317
  }
285
318
 
286
319
  private getUserAgent(): string {
@@ -312,12 +345,13 @@ export class SentDm {
312
345
  : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
313
346
 
314
347
  const defaultQuery = this.defaultQuery();
315
- if (!isEmptyObj(defaultQuery)) {
316
- query = { ...defaultQuery, ...query };
348
+ const pathQuery = Object.fromEntries(url.searchParams);
349
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
350
+ query = { ...pathQuery, ...defaultQuery, ...query };
317
351
  }
318
352
 
319
353
  if (typeof query === 'object' && query && !Array.isArray(query)) {
320
- url.search = this.stringifyQuery(query as Record<string, unknown>);
354
+ url.search = this.stringifyQuery(query);
321
355
  }
322
356
 
323
357
  return url.toString();
@@ -622,9 +656,9 @@ export class SentDm {
622
656
  }
623
657
  }
624
658
 
625
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
626
- // just do what it says, but otherwise calculate a default
627
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
659
+ // If the API asks us to wait a certain amount of time, just do what it
660
+ // says, but otherwise calculate a default
661
+ if (timeoutMillis === undefined) {
628
662
  const maxRetries = options.maxRetries ?? this.maxRetries;
629
663
  timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
630
664
  }
@@ -756,7 +790,7 @@ export class SentDm {
756
790
  ) {
757
791
  return {
758
792
  bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
759
- body: this.stringifyQuery(body as Record<string, unknown>),
793
+ body: this.stringifyQuery(body),
760
794
  };
761
795
  } else {
762
796
  return this.#encoder({ body, headers });
@@ -782,51 +816,165 @@ export class SentDm {
782
816
 
783
817
  static toFile = Uploads.toFile;
784
818
 
785
- contacts: API.Contacts = new API.Contacts(this);
786
- messages: API.Messages = new API.Messages(this);
819
+ /**
820
+ * Configure webhook endpoints for real-time event delivery
821
+ */
822
+ webhooks: API.Webhooks = new API.Webhooks(this);
823
+ /**
824
+ * Invite, update, and manage organization users and roles
825
+ */
826
+ users: API.Users = new API.Users(this);
827
+ /**
828
+ * Manage message templates with variable substitution
829
+ */
787
830
  templates: API.Templates = new API.Templates(this);
788
- numberLookup: API.NumberLookup = new API.NumberLookup(this);
831
+ /**
832
+ * Manage organization profiles
833
+ */
834
+ profiles: API.Profiles = new API.Profiles(this);
835
+ /**
836
+ * Manage and lookup phone numbers
837
+ */
838
+ numbers: API.Numbers = new API.Numbers(this);
839
+ /**
840
+ * Send and track SMS and WhatsApp messages
841
+ */
842
+ messages: API.Messages = new API.Messages(this);
843
+ /**
844
+ * Create, update, and manage customer contact lists
845
+ */
846
+ contacts: API.Contacts = new API.Contacts(this);
847
+ /**
848
+ * Retrieve account details
849
+ */
850
+ me: API.Me = new API.Me(this);
789
851
  }
790
852
 
791
- SentDm.Contacts = Contacts;
792
- SentDm.Messages = Messages;
853
+ SentDm.Webhooks = Webhooks;
854
+ SentDm.Users = Users;
793
855
  SentDm.Templates = Templates;
794
- SentDm.NumberLookup = NumberLookup;
856
+ SentDm.Profiles = Profiles;
857
+ SentDm.Numbers = Numbers;
858
+ SentDm.Messages = Messages;
859
+ SentDm.Contacts = Contacts;
860
+ SentDm.Me = Me;
795
861
 
796
862
  export declare namespace SentDm {
797
863
  export type RequestOptions = Opts.RequestOptions;
798
864
 
799
865
  export {
800
- Contacts as Contacts,
801
- type ContactListItem as ContactListItem,
802
- type ContactListResponse as ContactListResponse,
803
- type ContactListParams as ContactListParams,
804
- type ContactRetrieveByPhoneParams as ContactRetrieveByPhoneParams,
805
- type ContactRetrieveIDParams as ContactRetrieveIDParams,
866
+ Webhooks as Webhooks,
867
+ type APIMeta as APIMeta,
868
+ type APIResponseWebhook as APIResponseWebhook,
869
+ type ErrorDetail as ErrorDetail,
870
+ type MutationRequest as MutationRequest,
871
+ type PaginationMeta as PaginationMeta,
872
+ type WebhookResponse as WebhookResponse,
873
+ type WebhookListResponse as WebhookListResponse,
874
+ type WebhookListEventTypesResponse as WebhookListEventTypesResponse,
875
+ type WebhookListEventsResponse as WebhookListEventsResponse,
876
+ type WebhookRotateSecretResponse as WebhookRotateSecretResponse,
877
+ type WebhookTestResponse as WebhookTestResponse,
878
+ type WebhookCreateParams as WebhookCreateParams,
879
+ type WebhookRetrieveParams as WebhookRetrieveParams,
880
+ type WebhookUpdateParams as WebhookUpdateParams,
881
+ type WebhookListParams as WebhookListParams,
882
+ type WebhookDeleteParams as WebhookDeleteParams,
883
+ type WebhookListEventTypesParams as WebhookListEventTypesParams,
884
+ type WebhookListEventsParams as WebhookListEventsParams,
885
+ type WebhookRotateSecretParams as WebhookRotateSecretParams,
886
+ type WebhookTestParams as WebhookTestParams,
887
+ type WebhookToggleStatusParams as WebhookToggleStatusParams,
806
888
  };
807
889
 
808
890
  export {
809
- Messages as Messages,
810
- type MessageRetrieveResponse as MessageRetrieveResponse,
811
- type MessageSendQuickMessageParams as MessageSendQuickMessageParams,
812
- type MessageSendToContactParams as MessageSendToContactParams,
813
- type MessageSendToPhoneParams as MessageSendToPhoneParams,
891
+ Users as Users,
892
+ type APIResponseOfUser as APIResponseOfUser,
893
+ type UserResponse as UserResponse,
894
+ type UserListResponse as UserListResponse,
895
+ type UserRetrieveParams as UserRetrieveParams,
896
+ type UserListParams as UserListParams,
897
+ type UserInviteParams as UserInviteParams,
898
+ type UserRemoveParams as UserRemoveParams,
899
+ type UserUpdateRoleParams as UserUpdateRoleParams,
814
900
  };
815
901
 
816
902
  export {
817
903
  Templates as Templates,
904
+ type APIResponseTemplate as APIResponseTemplate,
905
+ type SentDmServicesCommonContractsPocOsAuthenticationConfig as SentDmServicesCommonContractsPocOsAuthenticationConfig,
906
+ type SentDmServicesCommonContractsPocOsTemplateBody as SentDmServicesCommonContractsPocOsTemplateBody,
907
+ type SentDmServicesCommonContractsPocOsTemplateButton as SentDmServicesCommonContractsPocOsTemplateButton,
908
+ type SentDmServicesCommonContractsPocOsTemplateButtonProps as SentDmServicesCommonContractsPocOsTemplateButtonProps,
909
+ type SentDmServicesCommonContractsPocOsTemplateFooter as SentDmServicesCommonContractsPocOsTemplateFooter,
910
+ type SentDmServicesCommonContractsPocOsTemplateHeader as SentDmServicesCommonContractsPocOsTemplateHeader,
911
+ type Template as Template,
818
912
  type TemplateBodyContent as TemplateBodyContent,
819
913
  type TemplateDefinition as TemplateDefinition,
820
- type TemplateResponseV2 as TemplateResponseV2,
821
914
  type TemplateVariable as TemplateVariable,
822
915
  type TemplateListResponse as TemplateListResponse,
823
916
  type TemplateCreateParams as TemplateCreateParams,
917
+ type TemplateRetrieveParams as TemplateRetrieveParams,
918
+ type TemplateUpdateParams as TemplateUpdateParams,
824
919
  type TemplateListParams as TemplateListParams,
920
+ type TemplateDeleteParams as TemplateDeleteParams,
921
+ };
922
+
923
+ export {
924
+ Profiles as Profiles,
925
+ type APIResponseOfProfileDetail as APIResponseOfProfileDetail,
926
+ type BillingContactInfo as BillingContactInfo,
927
+ type BrandsBrandData as BrandsBrandData,
928
+ type DestinationCountry as DestinationCountry,
929
+ type PaymentDetails as PaymentDetails,
930
+ type ProfileDetail as ProfileDetail,
931
+ type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandBusinessInfo,
932
+ type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandComplianceInfo,
933
+ type SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo as SentDmServicesEndpointsCustomerApIv3ContractsRequestsBrandsBrandContactInfo,
934
+ type TcrBrandRelationship as TcrBrandRelationship,
935
+ type TcrVertical as TcrVertical,
936
+ type ProfileListResponse as ProfileListResponse,
937
+ type ProfileCompleteResponse as ProfileCompleteResponse,
938
+ type ProfileCreateParams as ProfileCreateParams,
939
+ type ProfileRetrieveParams as ProfileRetrieveParams,
940
+ type ProfileUpdateParams as ProfileUpdateParams,
941
+ type ProfileListParams as ProfileListParams,
942
+ type ProfileDeleteParams as ProfileDeleteParams,
943
+ type ProfileCompleteParams as ProfileCompleteParams,
944
+ };
945
+
946
+ export {
947
+ Numbers as Numbers,
948
+ type NumberLookupResponse as NumberLookupResponse,
949
+ type NumberLookupParams as NumberLookupParams,
950
+ };
951
+
952
+ export {
953
+ Messages as Messages,
954
+ type MessageRetrieveActivitiesResponse as MessageRetrieveActivitiesResponse,
955
+ type MessageRetrieveStatusResponse as MessageRetrieveStatusResponse,
956
+ type MessageSendResponse as MessageSendResponse,
957
+ type MessageRetrieveActivitiesParams as MessageRetrieveActivitiesParams,
958
+ type MessageRetrieveStatusParams as MessageRetrieveStatusParams,
959
+ type MessageSendParams as MessageSendParams,
960
+ };
961
+
962
+ export {
963
+ Contacts as Contacts,
964
+ type APIResponseOfContact as APIResponseOfContact,
965
+ type ContactResponse as ContactResponse,
966
+ type ContactListResponse as ContactListResponse,
967
+ type ContactCreateParams as ContactCreateParams,
968
+ type ContactRetrieveParams as ContactRetrieveParams,
969
+ type ContactUpdateParams as ContactUpdateParams,
970
+ type ContactListParams as ContactListParams,
971
+ type ContactDeleteParams as ContactDeleteParams,
825
972
  };
826
973
 
827
974
  export {
828
- NumberLookup as NumberLookup,
829
- type NumberLookupRetrieveResponse as NumberLookupRetrieveResponse,
830
- type NumberLookupRetrieveParams as NumberLookupRetrieveParams,
975
+ Me as Me,
976
+ type ProfileSettings as ProfileSettings,
977
+ type MeRetrieveResponse as MeRetrieveResponse,
978
+ type MeRetrieveParams as MeRetrieveParams,
831
979
  };
832
980
  }
@@ -107,7 +107,6 @@ export const formatRequestDetails = (details: {
107
107
  name,
108
108
  (
109
109
  name.toLowerCase() === 'x-api-key' ||
110
- name.toLowerCase() === 'x-sender-id' ||
111
110
  name.toLowerCase() === 'authorization' ||
112
111
  name.toLowerCase() === 'cookie' ||
113
112
  name.toLowerCase() === 'set-cookie'
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { SentDmError } from '../../core/error';
4
+
5
+ /**
6
+ * Basic re-implementation of `qs.stringify` for primitive types.
7
+ */
8
+ export function stringifyQuery(query: object | Record<string, unknown>) {
9
+ return Object.entries(query)
10
+ .filter(([_, value]) => typeof value !== 'undefined')
11
+ .map(([key, value]) => {
12
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
13
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
14
+ }
15
+ if (value === null) {
16
+ return `${encodeURIComponent(key)}=`;
17
+ }
18
+ throw new SentDmError(
19
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
20
+ );
21
+ })
22
+ .join('&');
23
+ }
@@ -6,3 +6,4 @@ export * from './utils/env';
6
6
  export * from './utils/log';
7
7
  export * from './utils/uuid';
8
8
  export * from './utils/sleep';
9
+ export * from './utils/query';