dodopayments 2.23.2 → 2.24.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 (142) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/bin/migration-config.json +187 -0
  3. package/client.d.mts +6 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +9 -2
  8. package/client.js.map +1 -1
  9. package/client.mjs +9 -2
  10. package/client.mjs.map +1 -1
  11. package/package.json +12 -1
  12. package/resources/checkout-sessions.d.mts +17 -2
  13. package/resources/checkout-sessions.d.mts.map +1 -1
  14. package/resources/checkout-sessions.d.ts +17 -2
  15. package/resources/checkout-sessions.d.ts.map +1 -1
  16. package/resources/customers/customer-portal.d.mts +5 -0
  17. package/resources/customers/customer-portal.d.mts.map +1 -1
  18. package/resources/customers/customer-portal.d.ts +5 -0
  19. package/resources/customers/customer-portal.d.ts.map +1 -1
  20. package/resources/customers/customer-portal.js +2 -2
  21. package/resources/customers/customer-portal.js.map +1 -1
  22. package/resources/customers/customer-portal.mjs +2 -2
  23. package/resources/customers/customer-portal.mjs.map +1 -1
  24. package/resources/customers/customers.d.mts +5 -0
  25. package/resources/customers/customers.d.mts.map +1 -1
  26. package/resources/customers/customers.d.ts +5 -0
  27. package/resources/customers/customers.d.ts.map +1 -1
  28. package/resources/customers/customers.js.map +1 -1
  29. package/resources/customers/customers.mjs.map +1 -1
  30. package/resources/index.d.mts +2 -0
  31. package/resources/index.d.mts.map +1 -1
  32. package/resources/index.d.ts +2 -0
  33. package/resources/index.d.ts.map +1 -1
  34. package/resources/index.js +5 -1
  35. package/resources/index.js.map +1 -1
  36. package/resources/index.mjs +2 -0
  37. package/resources/index.mjs.map +1 -1
  38. package/resources/invoices/payments.d.mts +1 -0
  39. package/resources/invoices/payments.d.mts.map +1 -1
  40. package/resources/invoices/payments.d.ts +1 -0
  41. package/resources/invoices/payments.d.ts.map +1 -1
  42. package/resources/invoices/payments.js +7 -0
  43. package/resources/invoices/payments.js.map +1 -1
  44. package/resources/invoices/payments.mjs +7 -0
  45. package/resources/invoices/payments.mjs.map +1 -1
  46. package/resources/payments.d.mts +5 -0
  47. package/resources/payments.d.mts.map +1 -1
  48. package/resources/payments.d.ts +5 -0
  49. package/resources/payments.d.ts.map +1 -1
  50. package/resources/product-collections/groups/groups.d.mts +107 -0
  51. package/resources/product-collections/groups/groups.d.mts.map +1 -0
  52. package/resources/product-collections/groups/groups.d.ts +107 -0
  53. package/resources/product-collections/groups/groups.d.ts.map +1 -0
  54. package/resources/product-collections/groups/groups.js +37 -0
  55. package/resources/product-collections/groups/groups.js.map +1 -0
  56. package/resources/product-collections/groups/groups.mjs +32 -0
  57. package/resources/product-collections/groups/groups.mjs.map +1 -0
  58. package/resources/product-collections/groups/index.d.mts +3 -0
  59. package/resources/product-collections/groups/index.d.mts.map +1 -0
  60. package/resources/product-collections/groups/index.d.ts +3 -0
  61. package/resources/product-collections/groups/index.d.ts.map +1 -0
  62. package/resources/product-collections/groups/index.js +9 -0
  63. package/resources/product-collections/groups/index.js.map +1 -0
  64. package/resources/product-collections/groups/index.mjs +4 -0
  65. package/resources/product-collections/groups/index.mjs.map +1 -0
  66. package/resources/product-collections/groups/items.d.mts +91 -0
  67. package/resources/product-collections/groups/items.d.mts.map +1 -0
  68. package/resources/product-collections/groups/items.d.ts +91 -0
  69. package/resources/product-collections/groups/items.d.ts.map +1 -0
  70. package/resources/product-collections/groups/items.js +30 -0
  71. package/resources/product-collections/groups/items.js.map +1 -0
  72. package/resources/product-collections/groups/items.mjs +26 -0
  73. package/resources/product-collections/groups/items.mjs.map +1 -0
  74. package/resources/product-collections/groups.d.mts +2 -0
  75. package/resources/product-collections/groups.d.mts.map +1 -0
  76. package/resources/product-collections/groups.d.ts +2 -0
  77. package/resources/product-collections/groups.d.ts.map +1 -0
  78. package/resources/product-collections/groups.js +6 -0
  79. package/resources/product-collections/groups.js.map +1 -0
  80. package/resources/product-collections/groups.mjs +3 -0
  81. package/resources/product-collections/groups.mjs.map +1 -0
  82. package/resources/product-collections/index.d.mts +3 -0
  83. package/resources/product-collections/index.d.mts.map +1 -0
  84. package/resources/product-collections/index.d.ts +3 -0
  85. package/resources/product-collections/index.d.ts.map +1 -0
  86. package/resources/product-collections/index.js +9 -0
  87. package/resources/product-collections/index.js.map +1 -0
  88. package/resources/product-collections/index.mjs +4 -0
  89. package/resources/product-collections/index.mjs.map +1 -0
  90. package/resources/product-collections/product-collections.d.mts +307 -0
  91. package/resources/product-collections/product-collections.d.mts.map +1 -0
  92. package/resources/product-collections/product-collections.d.ts +307 -0
  93. package/resources/product-collections/product-collections.d.ts.map +1 -0
  94. package/resources/product-collections/product-collections.js +49 -0
  95. package/resources/product-collections/product-collections.js.map +1 -0
  96. package/resources/product-collections/product-collections.mjs +44 -0
  97. package/resources/product-collections/product-collections.mjs.map +1 -0
  98. package/resources/product-collections.d.mts +2 -0
  99. package/resources/product-collections.d.mts.map +1 -0
  100. package/resources/product-collections.d.ts +2 -0
  101. package/resources/product-collections.d.ts.map +1 -0
  102. package/resources/product-collections.js +6 -0
  103. package/resources/product-collections.js.map +1 -0
  104. package/resources/product-collections.mjs +3 -0
  105. package/resources/product-collections.mjs.map +1 -0
  106. package/resources/subscriptions.d.mts +147 -3
  107. package/resources/subscriptions.d.mts.map +1 -1
  108. package/resources/subscriptions.d.ts +147 -3
  109. package/resources/subscriptions.d.ts.map +1 -1
  110. package/resources/subscriptions.js +6 -0
  111. package/resources/subscriptions.js.map +1 -1
  112. package/resources/subscriptions.mjs +6 -0
  113. package/resources/subscriptions.mjs.map +1 -1
  114. package/resources/your-webhook-url.d.mts +85 -0
  115. package/resources/your-webhook-url.d.mts.map +1 -0
  116. package/resources/your-webhook-url.d.ts +85 -0
  117. package/resources/your-webhook-url.d.ts.map +1 -0
  118. package/resources/your-webhook-url.js +26 -0
  119. package/resources/your-webhook-url.js.map +1 -0
  120. package/resources/your-webhook-url.mjs +22 -0
  121. package/resources/your-webhook-url.mjs.map +1 -0
  122. package/src/client.ts +37 -2
  123. package/src/resources/checkout-sessions.ts +20 -2
  124. package/src/resources/customers/customer-portal.ts +8 -2
  125. package/src/resources/customers/customers.ts +5 -0
  126. package/src/resources/index.ts +14 -0
  127. package/src/resources/invoices/payments.ts +8 -0
  128. package/src/resources/payments.ts +5 -0
  129. package/src/resources/product-collections/groups/groups.ts +174 -0
  130. package/src/resources/product-collections/groups/index.ts +16 -0
  131. package/src/resources/product-collections/groups/items.ts +149 -0
  132. package/src/resources/product-collections/groups.ts +3 -0
  133. package/src/resources/product-collections/index.ts +22 -0
  134. package/src/resources/product-collections/product-collections.ts +472 -0
  135. package/src/resources/product-collections.ts +3 -0
  136. package/src/resources/subscriptions.ts +193 -3
  137. package/src/resources/your-webhook-url.ts +138 -0
  138. package/src/version.ts +1 -1
  139. package/version.d.mts +1 -1
  140. package/version.d.ts +1 -1
  141. package/version.js +1 -1
  142. package/version.mjs +1 -1
@@ -0,0 +1,472 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as MiscAPI from '../misc';
5
+ import * as ProductsAPI from '../products/products';
6
+ import * as GroupsAPI from './groups/groups';
7
+ import {
8
+ GroupCreateParams,
9
+ GroupCreateResponse,
10
+ GroupDeleteParams,
11
+ GroupUpdateParams,
12
+ Groups,
13
+ } from './groups/groups';
14
+ import { APIPromise } from '../../core/api-promise';
15
+ import {
16
+ DefaultPageNumberPagination,
17
+ type DefaultPageNumberPaginationParams,
18
+ PagePromise,
19
+ } from '../../core/pagination';
20
+ import { buildHeaders } from '../../internal/headers';
21
+ import { RequestOptions } from '../../internal/request-options';
22
+ import { path } from '../../internal/utils/path';
23
+
24
+ export class ProductCollections extends APIResource {
25
+ groups: GroupsAPI.Groups = new GroupsAPI.Groups(this._client);
26
+
27
+ create(
28
+ body: ProductCollectionCreateParams,
29
+ options?: RequestOptions,
30
+ ): APIPromise<ProductCollectionCreateResponse> {
31
+ return this._client.post('/product-collections', { body, ...options });
32
+ }
33
+
34
+ retrieve(id: string, options?: RequestOptions): APIPromise<ProductCollectionRetrieveResponse> {
35
+ return this._client.get(path`/product-collections/${id}`, options);
36
+ }
37
+
38
+ update(id: string, body: ProductCollectionUpdateParams, options?: RequestOptions): APIPromise<void> {
39
+ return this._client.patch(path`/product-collections/${id}`, {
40
+ body,
41
+ ...options,
42
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
43
+ });
44
+ }
45
+
46
+ list(
47
+ query: ProductCollectionListParams | null | undefined = {},
48
+ options?: RequestOptions,
49
+ ): PagePromise<ProductCollectionListResponsesDefaultPageNumberPagination, ProductCollectionListResponse> {
50
+ return this._client.getAPIList(
51
+ '/product-collections',
52
+ DefaultPageNumberPagination<ProductCollectionListResponse>,
53
+ { query, ...options },
54
+ );
55
+ }
56
+
57
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
58
+ return this._client.delete(path`/product-collections/${id}`, {
59
+ ...options,
60
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
61
+ });
62
+ }
63
+
64
+ unarchive(id: string, options?: RequestOptions): APIPromise<ProductCollectionUnarchiveResponse> {
65
+ return this._client.post(path`/product-collections/${id}/unarchive`, options);
66
+ }
67
+
68
+ updateImages(
69
+ id: string,
70
+ params: ProductCollectionUpdateImagesParams | null | undefined = {},
71
+ options?: RequestOptions,
72
+ ): APIPromise<ProductCollectionUpdateImagesResponse> {
73
+ const { force_update } = params ?? {};
74
+ return this._client.put(path`/product-collections/${id}/images`, { query: { force_update }, ...options });
75
+ }
76
+ }
77
+
78
+ export type ProductCollectionListResponsesDefaultPageNumberPagination =
79
+ DefaultPageNumberPagination<ProductCollectionListResponse>;
80
+
81
+ export interface ProductCollectionCreateResponse {
82
+ /**
83
+ * Unique identifier for the product collection
84
+ */
85
+ id: string;
86
+
87
+ /**
88
+ * Brand ID for the collection
89
+ */
90
+ brand_id: string;
91
+
92
+ /**
93
+ * Timestamp when the collection was created
94
+ */
95
+ created_at: string;
96
+
97
+ /**
98
+ * Groups in this collection
99
+ */
100
+ groups: Array<ProductCollectionCreateResponse.Group>;
101
+
102
+ /**
103
+ * Name of the collection
104
+ */
105
+ name: string;
106
+
107
+ /**
108
+ * Timestamp when the collection was last updated
109
+ */
110
+ updated_at: string;
111
+
112
+ /**
113
+ * Description of the collection
114
+ */
115
+ description?: string | null;
116
+
117
+ /**
118
+ * URL of the collection image
119
+ */
120
+ image?: string | null;
121
+ }
122
+
123
+ export namespace ProductCollectionCreateResponse {
124
+ export interface Group {
125
+ group_id: string;
126
+
127
+ products: Array<Group.Product>;
128
+
129
+ status: boolean;
130
+
131
+ group_name?: string | null;
132
+ }
133
+
134
+ export namespace Group {
135
+ export interface Product {
136
+ id: string;
137
+
138
+ addons_count: number;
139
+
140
+ files_count: number;
141
+
142
+ /**
143
+ * Whether this product has any credit entitlements attached
144
+ */
145
+ has_credit_entitlements: boolean;
146
+
147
+ is_recurring: boolean;
148
+
149
+ license_key_enabled: boolean;
150
+
151
+ meters_count: number;
152
+
153
+ product_id: string;
154
+
155
+ status: boolean;
156
+
157
+ currency?: MiscAPI.Currency | null;
158
+
159
+ description?: string | null;
160
+
161
+ name?: string | null;
162
+
163
+ price?: number | null;
164
+
165
+ /**
166
+ * One-time price details.
167
+ */
168
+ price_detail?: ProductsAPI.Price | null;
169
+
170
+ /**
171
+ * Represents the different categories of taxation applicable to various products
172
+ * and services.
173
+ */
174
+ tax_category?: MiscAPI.TaxCategory | null;
175
+
176
+ tax_inclusive?: boolean | null;
177
+ }
178
+ }
179
+ }
180
+
181
+ export interface ProductCollectionRetrieveResponse {
182
+ /**
183
+ * Unique identifier for the product collection
184
+ */
185
+ id: string;
186
+
187
+ /**
188
+ * Brand ID for the collection
189
+ */
190
+ brand_id: string;
191
+
192
+ /**
193
+ * Timestamp when the collection was created
194
+ */
195
+ created_at: string;
196
+
197
+ /**
198
+ * Groups in this collection
199
+ */
200
+ groups: Array<ProductCollectionRetrieveResponse.Group>;
201
+
202
+ /**
203
+ * Name of the collection
204
+ */
205
+ name: string;
206
+
207
+ /**
208
+ * Timestamp when the collection was last updated
209
+ */
210
+ updated_at: string;
211
+
212
+ /**
213
+ * Description of the collection
214
+ */
215
+ description?: string | null;
216
+
217
+ /**
218
+ * URL of the collection image
219
+ */
220
+ image?: string | null;
221
+ }
222
+
223
+ export namespace ProductCollectionRetrieveResponse {
224
+ export interface Group {
225
+ group_id: string;
226
+
227
+ products: Array<Group.Product>;
228
+
229
+ status: boolean;
230
+
231
+ group_name?: string | null;
232
+ }
233
+
234
+ export namespace Group {
235
+ export interface Product {
236
+ id: string;
237
+
238
+ addons_count: number;
239
+
240
+ files_count: number;
241
+
242
+ /**
243
+ * Whether this product has any credit entitlements attached
244
+ */
245
+ has_credit_entitlements: boolean;
246
+
247
+ is_recurring: boolean;
248
+
249
+ license_key_enabled: boolean;
250
+
251
+ meters_count: number;
252
+
253
+ product_id: string;
254
+
255
+ status: boolean;
256
+
257
+ currency?: MiscAPI.Currency | null;
258
+
259
+ description?: string | null;
260
+
261
+ name?: string | null;
262
+
263
+ price?: number | null;
264
+
265
+ /**
266
+ * One-time price details.
267
+ */
268
+ price_detail?: ProductsAPI.Price | null;
269
+
270
+ /**
271
+ * Represents the different categories of taxation applicable to various products
272
+ * and services.
273
+ */
274
+ tax_category?: MiscAPI.TaxCategory | null;
275
+
276
+ tax_inclusive?: boolean | null;
277
+ }
278
+ }
279
+ }
280
+
281
+ export interface ProductCollectionListResponse {
282
+ /**
283
+ * Collection ID
284
+ */
285
+ id: string;
286
+
287
+ /**
288
+ * Timestamp when created
289
+ */
290
+ created_at: string;
291
+
292
+ /**
293
+ * Collection name
294
+ */
295
+ name: string;
296
+
297
+ /**
298
+ * Number of products in the collection
299
+ */
300
+ products_count: number;
301
+
302
+ /**
303
+ * Timestamp when last updated
304
+ */
305
+ updated_at: string;
306
+
307
+ /**
308
+ * Collection description
309
+ */
310
+ description?: string | null;
311
+
312
+ /**
313
+ * Collection image URL
314
+ */
315
+ image?: string | null;
316
+ }
317
+
318
+ export interface ProductCollectionUnarchiveResponse {
319
+ /**
320
+ * Collection ID that was unarchived
321
+ */
322
+ collection_id: string;
323
+
324
+ /**
325
+ * Product IDs that were excluded because they are archived
326
+ */
327
+ excluded_product_ids: Array<string>;
328
+
329
+ /**
330
+ * Success message
331
+ */
332
+ message: string;
333
+ }
334
+
335
+ export interface ProductCollectionUpdateImagesResponse {
336
+ /**
337
+ * Presigned S3 URL for uploading the image
338
+ */
339
+ url: string;
340
+
341
+ /**
342
+ * Optional image ID (present when force_update is true)
343
+ */
344
+ image_id?: string | null;
345
+ }
346
+
347
+ export interface ProductCollectionCreateParams {
348
+ /**
349
+ * Groups of products in this collection
350
+ */
351
+ groups: Array<ProductCollectionCreateParams.Group>;
352
+
353
+ /**
354
+ * Name of the product collection
355
+ */
356
+ name: string;
357
+
358
+ /**
359
+ * Brand id for the collection, if not provided will default to primary brand
360
+ */
361
+ brand_id?: string | null;
362
+
363
+ /**
364
+ * Optional description of the product collection
365
+ */
366
+ description?: string | null;
367
+ }
368
+
369
+ export namespace ProductCollectionCreateParams {
370
+ export interface Group {
371
+ /**
372
+ * Products in this group
373
+ */
374
+ products: Array<Group.Product>;
375
+
376
+ /**
377
+ * Optional group name. Multiple groups can have null names, but named groups must
378
+ * be unique per collection
379
+ */
380
+ group_name?: string | null;
381
+
382
+ /**
383
+ * Status of the group (defaults to true if not provided)
384
+ */
385
+ status?: boolean | null;
386
+ }
387
+
388
+ export namespace Group {
389
+ export interface Product {
390
+ /**
391
+ * Product ID to include in the group
392
+ */
393
+ product_id: string;
394
+
395
+ /**
396
+ * Status of the product in this group (defaults to true if not provided)
397
+ */
398
+ status?: boolean | null;
399
+ }
400
+ }
401
+ }
402
+
403
+ export interface ProductCollectionUpdateParams {
404
+ /**
405
+ * Optional brand_id update
406
+ */
407
+ brand_id?: string | null;
408
+
409
+ /**
410
+ * Optional description update - pass null to remove, omit to keep unchanged
411
+ */
412
+ description?: string | null;
413
+
414
+ /**
415
+ * Optional new order for groups (array of group UUIDs in desired order)
416
+ */
417
+ group_order?: Array<string> | null;
418
+
419
+ /**
420
+ * Optional image update - pass null to remove, omit to keep unchanged
421
+ */
422
+ image_id?: string | null;
423
+
424
+ /**
425
+ * Optional new name for the collection
426
+ */
427
+ name?: string | null;
428
+ }
429
+
430
+ export interface ProductCollectionListParams extends DefaultPageNumberPaginationParams {
431
+ /**
432
+ * List archived collections
433
+ */
434
+ archived?: boolean;
435
+
436
+ /**
437
+ * Filter by Brand id
438
+ */
439
+ brand_id?: string;
440
+ }
441
+
442
+ export interface ProductCollectionUpdateImagesParams {
443
+ /**
444
+ * If true, generates a new image ID to force cache invalidation
445
+ */
446
+ force_update?: boolean | null;
447
+ }
448
+
449
+ ProductCollections.Groups = Groups;
450
+
451
+ export declare namespace ProductCollections {
452
+ export {
453
+ type ProductCollectionCreateResponse as ProductCollectionCreateResponse,
454
+ type ProductCollectionRetrieveResponse as ProductCollectionRetrieveResponse,
455
+ type ProductCollectionListResponse as ProductCollectionListResponse,
456
+ type ProductCollectionUnarchiveResponse as ProductCollectionUnarchiveResponse,
457
+ type ProductCollectionUpdateImagesResponse as ProductCollectionUpdateImagesResponse,
458
+ type ProductCollectionListResponsesDefaultPageNumberPagination as ProductCollectionListResponsesDefaultPageNumberPagination,
459
+ type ProductCollectionCreateParams as ProductCollectionCreateParams,
460
+ type ProductCollectionUpdateParams as ProductCollectionUpdateParams,
461
+ type ProductCollectionListParams as ProductCollectionListParams,
462
+ type ProductCollectionUpdateImagesParams as ProductCollectionUpdateImagesParams,
463
+ };
464
+
465
+ export {
466
+ Groups as Groups,
467
+ type GroupCreateResponse as GroupCreateResponse,
468
+ type GroupCreateParams as GroupCreateParams,
469
+ type GroupUpdateParams as GroupUpdateParams,
470
+ type GroupDeleteParams as GroupDeleteParams,
471
+ };
472
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './product-collections/index';