dodopayments 2.31.2 → 2.32.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 (363) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +7 -7
  3. package/api-promise.d.mts +1 -0
  4. package/api-promise.d.mts.map +1 -1
  5. package/api-promise.d.ts +1 -0
  6. package/api-promise.d.ts.map +1 -1
  7. package/api-promise.mjs +1 -0
  8. package/api-promise.mjs.map +1 -1
  9. package/bin/migration-config.json +187 -0
  10. package/client.d.mts +9 -6
  11. package/client.d.mts.map +1 -1
  12. package/client.d.ts +9 -6
  13. package/client.d.ts.map +1 -1
  14. package/client.js +3 -0
  15. package/client.js.map +1 -1
  16. package/client.mjs +3 -0
  17. package/client.mjs.map +1 -1
  18. package/core/api-promise.d.mts.map +1 -1
  19. package/core/api-promise.d.ts.map +1 -1
  20. package/core/api-promise.mjs.map +1 -1
  21. package/core/error.mjs.map +1 -1
  22. package/core/pagination.d.mts.map +1 -1
  23. package/core/pagination.d.ts.map +1 -1
  24. package/core/pagination.mjs.map +1 -1
  25. package/core/resource.d.mts.map +1 -1
  26. package/core/resource.d.ts.map +1 -1
  27. package/core/uploads.d.mts.map +1 -1
  28. package/core/uploads.d.ts.map +1 -1
  29. package/core/uploads.mjs.map +1 -1
  30. package/error.d.mts +1 -0
  31. package/error.d.mts.map +1 -1
  32. package/error.d.ts +1 -0
  33. package/error.d.ts.map +1 -1
  34. package/error.mjs +1 -0
  35. package/error.mjs.map +1 -1
  36. package/index.d.mts.map +1 -1
  37. package/index.d.ts.map +1 -1
  38. package/index.mjs.map +1 -1
  39. package/internal/detect-platform.mjs.map +1 -1
  40. package/internal/headers.mjs.map +1 -1
  41. package/internal/parse.d.mts.map +1 -1
  42. package/internal/parse.d.ts.map +1 -1
  43. package/internal/parse.mjs.map +1 -1
  44. package/internal/request-options.d.mts.map +1 -1
  45. package/internal/request-options.d.ts.map +1 -1
  46. package/internal/shims.d.mts +6 -0
  47. package/internal/shims.d.mts.map +1 -1
  48. package/internal/shims.d.ts +6 -0
  49. package/internal/shims.d.ts.map +1 -1
  50. package/internal/to-file.d.mts.map +1 -1
  51. package/internal/to-file.d.ts.map +1 -1
  52. package/internal/to-file.mjs.map +1 -1
  53. package/internal/types.d.mts +4 -4
  54. package/internal/types.d.mts.map +1 -1
  55. package/internal/types.d.ts +4 -4
  56. package/internal/types.d.ts.map +1 -1
  57. package/internal/uploads.d.mts.map +1 -1
  58. package/internal/uploads.d.ts.map +1 -1
  59. package/internal/uploads.mjs.map +1 -1
  60. package/internal/utils/base64.mjs.map +1 -1
  61. package/internal/utils/log.d.mts.map +1 -1
  62. package/internal/utils/log.d.ts.map +1 -1
  63. package/internal/utils/log.mjs.map +1 -1
  64. package/internal/utils/path.mjs.map +1 -1
  65. package/internal/utils/query.mjs.map +1 -1
  66. package/internal/utils/values.mjs.map +1 -1
  67. package/internal/utils.d.mts.map +1 -1
  68. package/internal/utils.d.ts.map +1 -1
  69. package/internal/utils.mjs.map +1 -1
  70. package/package.json +1 -1
  71. package/pagination.d.mts +1 -0
  72. package/pagination.d.mts.map +1 -1
  73. package/pagination.d.ts +1 -0
  74. package/pagination.d.ts.map +1 -1
  75. package/pagination.mjs +1 -0
  76. package/pagination.mjs.map +1 -1
  77. package/resource.d.mts +1 -0
  78. package/resource.d.mts.map +1 -1
  79. package/resource.d.ts +1 -0
  80. package/resource.d.ts.map +1 -1
  81. package/resource.mjs +1 -0
  82. package/resource.mjs.map +1 -1
  83. package/resources/addons.d.mts.map +1 -1
  84. package/resources/addons.d.ts.map +1 -1
  85. package/resources/addons.mjs.map +1 -1
  86. package/resources/balances.d.mts.map +1 -1
  87. package/resources/balances.d.ts.map +1 -1
  88. package/resources/balances.mjs.map +1 -1
  89. package/resources/brands.d.mts.map +1 -1
  90. package/resources/brands.d.ts.map +1 -1
  91. package/resources/brands.mjs.map +1 -1
  92. package/resources/checkout-sessions.d.mts +45 -0
  93. package/resources/checkout-sessions.d.mts.map +1 -1
  94. package/resources/checkout-sessions.d.ts +45 -0
  95. package/resources/checkout-sessions.d.ts.map +1 -1
  96. package/resources/checkout-sessions.mjs.map +1 -1
  97. package/resources/credit-entitlements/balances.d.mts.map +1 -1
  98. package/resources/credit-entitlements/balances.d.ts.map +1 -1
  99. package/resources/credit-entitlements/balances.mjs.map +1 -1
  100. package/resources/credit-entitlements/credit-entitlements.d.mts.map +1 -1
  101. package/resources/credit-entitlements/credit-entitlements.d.ts.map +1 -1
  102. package/resources/credit-entitlements/credit-entitlements.mjs.map +1 -1
  103. package/resources/credit-entitlements/index.d.mts.map +1 -1
  104. package/resources/credit-entitlements/index.d.ts.map +1 -1
  105. package/resources/credit-entitlements/index.mjs.map +1 -1
  106. package/resources/credit-entitlements.d.mts.map +1 -1
  107. package/resources/credit-entitlements.d.ts.map +1 -1
  108. package/resources/credit-entitlements.mjs.map +1 -1
  109. package/resources/customers/customer-portal.d.mts.map +1 -1
  110. package/resources/customers/customer-portal.d.ts.map +1 -1
  111. package/resources/customers/customer-portal.mjs.map +1 -1
  112. package/resources/customers/customers.d.mts.map +1 -1
  113. package/resources/customers/customers.d.ts.map +1 -1
  114. package/resources/customers/customers.mjs.map +1 -1
  115. package/resources/customers/index.d.mts.map +1 -1
  116. package/resources/customers/index.d.ts.map +1 -1
  117. package/resources/customers/index.mjs.map +1 -1
  118. package/resources/customers/wallets/index.d.mts.map +1 -1
  119. package/resources/customers/wallets/index.d.ts.map +1 -1
  120. package/resources/customers/wallets/index.mjs.map +1 -1
  121. package/resources/customers/wallets/ledger-entries.d.mts.map +1 -1
  122. package/resources/customers/wallets/ledger-entries.d.ts.map +1 -1
  123. package/resources/customers/wallets/ledger-entries.mjs.map +1 -1
  124. package/resources/customers/wallets/wallets.d.mts.map +1 -1
  125. package/resources/customers/wallets/wallets.d.ts.map +1 -1
  126. package/resources/customers/wallets/wallets.mjs.map +1 -1
  127. package/resources/customers/wallets.d.mts.map +1 -1
  128. package/resources/customers/wallets.d.ts.map +1 -1
  129. package/resources/customers/wallets.mjs.map +1 -1
  130. package/resources/customers.d.mts.map +1 -1
  131. package/resources/customers.d.ts.map +1 -1
  132. package/resources/customers.mjs.map +1 -1
  133. package/resources/discounts.d.mts +74 -1
  134. package/resources/discounts.d.mts.map +1 -1
  135. package/resources/discounts.d.ts +74 -1
  136. package/resources/discounts.d.ts.map +1 -1
  137. package/resources/discounts.mjs.map +1 -1
  138. package/resources/disputes.d.mts.map +1 -1
  139. package/resources/disputes.d.ts.map +1 -1
  140. package/resources/disputes.mjs.map +1 -1
  141. package/resources/entitlements/entitlements.d.mts +8 -3
  142. package/resources/entitlements/entitlements.d.mts.map +1 -1
  143. package/resources/entitlements/entitlements.d.ts +8 -3
  144. package/resources/entitlements/entitlements.d.ts.map +1 -1
  145. package/resources/entitlements/entitlements.js.map +1 -1
  146. package/resources/entitlements/entitlements.mjs.map +1 -1
  147. package/resources/entitlements/files.d.mts.map +1 -1
  148. package/resources/entitlements/files.d.ts.map +1 -1
  149. package/resources/entitlements/files.mjs.map +1 -1
  150. package/resources/entitlements/grants.d.mts.map +1 -1
  151. package/resources/entitlements/grants.d.ts.map +1 -1
  152. package/resources/entitlements/grants.mjs.map +1 -1
  153. package/resources/entitlements/index.d.mts +1 -1
  154. package/resources/entitlements/index.d.mts.map +1 -1
  155. package/resources/entitlements/index.d.ts +1 -1
  156. package/resources/entitlements/index.d.ts.map +1 -1
  157. package/resources/entitlements/index.js.map +1 -1
  158. package/resources/entitlements/index.mjs.map +1 -1
  159. package/resources/entitlements.d.mts.map +1 -1
  160. package/resources/entitlements.d.ts.map +1 -1
  161. package/resources/entitlements.mjs.map +1 -1
  162. package/resources/index.d.mts +4 -3
  163. package/resources/index.d.mts.map +1 -1
  164. package/resources/index.d.ts +4 -3
  165. package/resources/index.d.ts.map +1 -1
  166. package/resources/index.js +3 -1
  167. package/resources/index.js.map +1 -1
  168. package/resources/index.mjs +1 -0
  169. package/resources/index.mjs.map +1 -1
  170. package/resources/invoices/index.d.mts.map +1 -1
  171. package/resources/invoices/index.d.ts.map +1 -1
  172. package/resources/invoices/index.mjs.map +1 -1
  173. package/resources/invoices/invoices.d.mts.map +1 -1
  174. package/resources/invoices/invoices.d.ts.map +1 -1
  175. package/resources/invoices/invoices.mjs.map +1 -1
  176. package/resources/invoices/payments.d.mts +1 -0
  177. package/resources/invoices/payments.d.mts.map +1 -1
  178. package/resources/invoices/payments.d.ts +1 -0
  179. package/resources/invoices/payments.d.ts.map +1 -1
  180. package/resources/invoices/payments.js +7 -0
  181. package/resources/invoices/payments.js.map +1 -1
  182. package/resources/invoices/payments.mjs +7 -0
  183. package/resources/invoices/payments.mjs.map +1 -1
  184. package/resources/invoices.d.mts.map +1 -1
  185. package/resources/invoices.d.ts.map +1 -1
  186. package/resources/invoices.mjs.map +1 -1
  187. package/resources/license-key-instances.d.mts.map +1 -1
  188. package/resources/license-key-instances.d.ts.map +1 -1
  189. package/resources/license-key-instances.mjs.map +1 -1
  190. package/resources/license-keys.d.mts.map +1 -1
  191. package/resources/license-keys.d.ts.map +1 -1
  192. package/resources/license-keys.mjs.map +1 -1
  193. package/resources/licenses.d.mts.map +1 -1
  194. package/resources/licenses.d.ts.map +1 -1
  195. package/resources/licenses.mjs.map +1 -1
  196. package/resources/meters.d.mts +24 -96
  197. package/resources/meters.d.mts.map +1 -1
  198. package/resources/meters.d.ts +24 -96
  199. package/resources/meters.d.ts.map +1 -1
  200. package/resources/meters.mjs.map +1 -1
  201. package/resources/misc.d.mts.map +1 -1
  202. package/resources/misc.d.ts.map +1 -1
  203. package/resources/misc.mjs.map +1 -1
  204. package/resources/payments.d.mts +8 -75
  205. package/resources/payments.d.mts.map +1 -1
  206. package/resources/payments.d.ts +8 -75
  207. package/resources/payments.d.ts.map +1 -1
  208. package/resources/payments.mjs.map +1 -1
  209. package/resources/payouts/breakup/breakup.d.mts.map +1 -1
  210. package/resources/payouts/breakup/breakup.d.ts.map +1 -1
  211. package/resources/payouts/breakup/breakup.mjs.map +1 -1
  212. package/resources/payouts/breakup/details.d.mts.map +1 -1
  213. package/resources/payouts/breakup/details.d.ts.map +1 -1
  214. package/resources/payouts/breakup/details.mjs.map +1 -1
  215. package/resources/payouts/breakup/index.d.mts.map +1 -1
  216. package/resources/payouts/breakup/index.d.ts.map +1 -1
  217. package/resources/payouts/breakup/index.mjs.map +1 -1
  218. package/resources/payouts/breakup.d.mts.map +1 -1
  219. package/resources/payouts/breakup.d.ts.map +1 -1
  220. package/resources/payouts/breakup.mjs.map +1 -1
  221. package/resources/payouts/index.d.mts.map +1 -1
  222. package/resources/payouts/index.d.ts.map +1 -1
  223. package/resources/payouts/index.mjs.map +1 -1
  224. package/resources/payouts/payouts.d.mts.map +1 -1
  225. package/resources/payouts/payouts.d.ts.map +1 -1
  226. package/resources/payouts/payouts.mjs.map +1 -1
  227. package/resources/payouts.d.mts.map +1 -1
  228. package/resources/payouts.d.ts.map +1 -1
  229. package/resources/payouts.mjs.map +1 -1
  230. package/resources/product-collections/groups/groups.d.mts +88 -0
  231. package/resources/product-collections/groups/groups.d.mts.map +1 -0
  232. package/resources/product-collections/groups/groups.d.ts +88 -0
  233. package/resources/product-collections/groups/groups.d.ts.map +1 -0
  234. package/resources/product-collections/groups/groups.js +37 -0
  235. package/resources/product-collections/groups/groups.js.map +1 -0
  236. package/resources/product-collections/groups/groups.mjs +32 -0
  237. package/resources/product-collections/groups/groups.mjs.map +1 -0
  238. package/resources/product-collections/groups/index.d.mts +3 -0
  239. package/resources/product-collections/groups/index.d.mts.map +1 -0
  240. package/resources/product-collections/groups/index.d.ts +3 -0
  241. package/resources/product-collections/groups/index.d.ts.map +1 -0
  242. package/resources/product-collections/groups/index.js +9 -0
  243. package/resources/product-collections/groups/index.js.map +1 -0
  244. package/resources/product-collections/groups/index.mjs +4 -0
  245. package/resources/product-collections/groups/index.mjs.map +1 -0
  246. package/resources/product-collections/groups/items.d.mts +78 -0
  247. package/resources/product-collections/groups/items.d.mts.map +1 -0
  248. package/resources/product-collections/groups/items.d.ts +78 -0
  249. package/resources/product-collections/groups/items.d.ts.map +1 -0
  250. package/resources/product-collections/groups/items.js +30 -0
  251. package/resources/product-collections/groups/items.js.map +1 -0
  252. package/resources/product-collections/groups/items.mjs +26 -0
  253. package/resources/product-collections/groups/items.mjs.map +1 -0
  254. package/resources/product-collections/groups.d.mts +2 -0
  255. package/resources/product-collections/groups.d.mts.map +1 -0
  256. package/resources/product-collections/groups.d.ts +2 -0
  257. package/resources/product-collections/groups.d.ts.map +1 -0
  258. package/resources/product-collections/groups.js +6 -0
  259. package/resources/product-collections/groups.js.map +1 -0
  260. package/resources/product-collections/groups.mjs +3 -0
  261. package/resources/product-collections/groups.mjs.map +1 -0
  262. package/resources/product-collections/index.d.mts +3 -0
  263. package/resources/product-collections/index.d.mts.map +1 -0
  264. package/resources/product-collections/index.d.ts +3 -0
  265. package/resources/product-collections/index.d.ts.map +1 -0
  266. package/resources/product-collections/index.js +9 -0
  267. package/resources/product-collections/index.js.map +1 -0
  268. package/resources/product-collections/index.mjs +4 -0
  269. package/resources/product-collections/index.mjs.map +1 -0
  270. package/resources/product-collections/product-collections.d.mts +166 -0
  271. package/resources/product-collections/product-collections.d.mts.map +1 -0
  272. package/resources/product-collections/product-collections.d.ts +166 -0
  273. package/resources/product-collections/product-collections.d.ts.map +1 -0
  274. package/resources/product-collections/product-collections.js +49 -0
  275. package/resources/product-collections/product-collections.js.map +1 -0
  276. package/resources/product-collections/product-collections.mjs +44 -0
  277. package/resources/product-collections/product-collections.mjs.map +1 -0
  278. package/resources/product-collections.d.mts +2 -0
  279. package/resources/product-collections.d.mts.map +1 -0
  280. package/resources/product-collections.d.ts +2 -0
  281. package/resources/product-collections.d.ts.map +1 -0
  282. package/resources/product-collections.js +6 -0
  283. package/resources/product-collections.js.map +1 -0
  284. package/resources/product-collections.mjs +3 -0
  285. package/resources/product-collections.mjs.map +1 -0
  286. package/resources/products/images.d.mts.map +1 -1
  287. package/resources/products/images.d.ts.map +1 -1
  288. package/resources/products/images.mjs.map +1 -1
  289. package/resources/products/index.d.mts.map +1 -1
  290. package/resources/products/index.d.ts.map +1 -1
  291. package/resources/products/index.mjs.map +1 -1
  292. package/resources/products/products.d.mts.map +1 -1
  293. package/resources/products/products.d.ts.map +1 -1
  294. package/resources/products/products.mjs.map +1 -1
  295. package/resources/products/short-links.d.mts.map +1 -1
  296. package/resources/products/short-links.d.ts.map +1 -1
  297. package/resources/products/short-links.mjs.map +1 -1
  298. package/resources/products.d.mts.map +1 -1
  299. package/resources/products.d.ts.map +1 -1
  300. package/resources/products.mjs.map +1 -1
  301. package/resources/refunds.d.mts.map +1 -1
  302. package/resources/refunds.d.ts.map +1 -1
  303. package/resources/refunds.mjs.map +1 -1
  304. package/resources/subscriptions.d.mts +28 -78
  305. package/resources/subscriptions.d.mts.map +1 -1
  306. package/resources/subscriptions.d.ts +28 -78
  307. package/resources/subscriptions.d.ts.map +1 -1
  308. package/resources/subscriptions.js +3 -2
  309. package/resources/subscriptions.js.map +1 -1
  310. package/resources/subscriptions.mjs +3 -2
  311. package/resources/subscriptions.mjs.map +1 -1
  312. package/resources/usage-events.d.mts.map +1 -1
  313. package/resources/usage-events.d.ts.map +1 -1
  314. package/resources/usage-events.mjs.map +1 -1
  315. package/resources/webhook-events.d.mts +1 -1
  316. package/resources/webhook-events.d.mts.map +1 -1
  317. package/resources/webhook-events.d.ts +1 -1
  318. package/resources/webhook-events.d.ts.map +1 -1
  319. package/resources/webhook-events.mjs.map +1 -1
  320. package/resources/webhooks/headers.d.mts.map +1 -1
  321. package/resources/webhooks/headers.d.ts.map +1 -1
  322. package/resources/webhooks/headers.mjs.map +1 -1
  323. package/resources/webhooks/index.d.mts.map +1 -1
  324. package/resources/webhooks/index.d.ts.map +1 -1
  325. package/resources/webhooks/index.mjs.map +1 -1
  326. package/resources/webhooks/webhooks.d.mts.map +1 -1
  327. package/resources/webhooks/webhooks.d.ts.map +1 -1
  328. package/resources/webhooks/webhooks.mjs.map +1 -1
  329. package/resources/webhooks.d.mts.map +1 -1
  330. package/resources/webhooks.d.ts.map +1 -1
  331. package/resources/webhooks.mjs.map +1 -1
  332. package/resources.d.mts.map +1 -1
  333. package/resources.d.ts.map +1 -1
  334. package/resources.mjs.map +1 -1
  335. package/src/client.ts +33 -0
  336. package/src/resources/checkout-sessions.ts +52 -0
  337. package/src/resources/discounts.ts +88 -0
  338. package/src/resources/entitlements/entitlements.ts +9 -2
  339. package/src/resources/entitlements/index.ts +1 -0
  340. package/src/resources/index.ts +15 -0
  341. package/src/resources/invoices/payments.ts +8 -0
  342. package/src/resources/meters.ts +28 -113
  343. package/src/resources/payments.ts +9 -88
  344. package/src/resources/product-collections/groups/groups.ts +156 -0
  345. package/src/resources/product-collections/groups/index.ts +19 -0
  346. package/src/resources/product-collections/groups/items.ts +135 -0
  347. package/src/resources/product-collections/groups.ts +3 -0
  348. package/src/resources/product-collections/index.ts +23 -0
  349. package/src/resources/product-collections/product-collections.ts +278 -0
  350. package/src/resources/product-collections.ts +3 -0
  351. package/src/resources/subscriptions.ts +35 -96
  352. package/src/resources/webhook-events.ts +1 -5
  353. package/src/version.ts +1 -1
  354. package/uploads.d.mts +1 -0
  355. package/uploads.d.mts.map +1 -1
  356. package/uploads.d.ts +1 -0
  357. package/uploads.d.ts.map +1 -1
  358. package/uploads.mjs +1 -0
  359. package/uploads.mjs.map +1 -1
  360. package/version.d.mts +1 -1
  361. package/version.d.ts +1 -1
  362. package/version.js +1 -1
  363. package/version.mjs +1 -1
@@ -0,0 +1,156 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as ItemsAPI from './items';
5
+ import {
6
+ ItemCreateParams,
7
+ ItemCreateResponse,
8
+ ItemDeleteParams,
9
+ ItemUpdateParams,
10
+ Items,
11
+ ProductCollectionProduct,
12
+ } from './items';
13
+ import { APIPromise } from '../../../core/api-promise';
14
+ import { buildHeaders } from '../../../internal/headers';
15
+ import { RequestOptions } from '../../../internal/request-options';
16
+ import { path } from '../../../internal/utils/path';
17
+
18
+ export class Groups extends APIResource {
19
+ items: ItemsAPI.Items = new ItemsAPI.Items(this._client);
20
+
21
+ create(
22
+ id: string,
23
+ body: GroupCreateParams,
24
+ options?: RequestOptions,
25
+ ): APIPromise<ProductCollectionGroupResponse> {
26
+ return this._client.post(path`/product-collections/${id}/groups`, { body, ...options });
27
+ }
28
+
29
+ update(groupID: string, params: GroupUpdateParams, options?: RequestOptions): APIPromise<void> {
30
+ const { id, ...body } = params;
31
+ return this._client.patch(path`/product-collections/${id}/groups/${groupID}`, {
32
+ body,
33
+ ...options,
34
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
35
+ });
36
+ }
37
+
38
+ delete(groupID: string, params: GroupDeleteParams, options?: RequestOptions): APIPromise<void> {
39
+ const { id } = params;
40
+ return this._client.delete(path`/product-collections/${id}/groups/${groupID}`, {
41
+ ...options,
42
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
43
+ });
44
+ }
45
+ }
46
+
47
+ export interface GroupProduct {
48
+ /**
49
+ * Product ID to include in the group
50
+ */
51
+ product_id: string;
52
+
53
+ /**
54
+ * Status of the product in this group (defaults to true if not provided)
55
+ */
56
+ status?: boolean | null;
57
+ }
58
+
59
+ export interface ProductCollectionGroupDetails {
60
+ /**
61
+ * Products in this group
62
+ */
63
+ products: Array<GroupProduct>;
64
+
65
+ /**
66
+ * Optional group name. Multiple groups can have null names, but named groups must
67
+ * be unique per collection
68
+ */
69
+ group_name?: string | null;
70
+
71
+ /**
72
+ * Status of the group (defaults to true if not provided)
73
+ */
74
+ status?: boolean | null;
75
+ }
76
+
77
+ export interface ProductCollectionGroupResponse {
78
+ group_id: string;
79
+
80
+ products: Array<ItemsAPI.ProductCollectionProduct>;
81
+
82
+ status: boolean;
83
+
84
+ group_name?: string | null;
85
+ }
86
+
87
+ export interface GroupCreateParams {
88
+ /**
89
+ * Products in this group
90
+ */
91
+ products: Array<GroupProduct>;
92
+
93
+ /**
94
+ * Optional group name. Multiple groups can have null names, but named groups must
95
+ * be unique per collection
96
+ */
97
+ group_name?: string | null;
98
+
99
+ /**
100
+ * Status of the group (defaults to true if not provided)
101
+ */
102
+ status?: boolean | null;
103
+ }
104
+
105
+ export interface GroupUpdateParams {
106
+ /**
107
+ * Path param: Product Collection Id
108
+ */
109
+ id: string;
110
+
111
+ /**
112
+ * Body param: Optional group name update: Some(Some(name)) = set name, Some(None)
113
+ * = clear name, None = no change
114
+ */
115
+ group_name?: string | null;
116
+
117
+ /**
118
+ * Body param: Optional new order for products in this group (array of
119
+ * product_collection_group_pdts UUIDs)
120
+ */
121
+ product_order?: Array<string> | null;
122
+
123
+ /**
124
+ * Body param: Optional status update
125
+ */
126
+ status?: boolean | null;
127
+ }
128
+
129
+ export interface GroupDeleteParams {
130
+ /**
131
+ * Product Collection Id
132
+ */
133
+ id: string;
134
+ }
135
+
136
+ Groups.Items = Items;
137
+
138
+ export declare namespace Groups {
139
+ export {
140
+ type GroupProduct as GroupProduct,
141
+ type ProductCollectionGroupDetails as ProductCollectionGroupDetails,
142
+ type ProductCollectionGroupResponse as ProductCollectionGroupResponse,
143
+ type GroupCreateParams as GroupCreateParams,
144
+ type GroupUpdateParams as GroupUpdateParams,
145
+ type GroupDeleteParams as GroupDeleteParams,
146
+ };
147
+
148
+ export {
149
+ Items as Items,
150
+ type ProductCollectionProduct as ProductCollectionProduct,
151
+ type ItemCreateResponse as ItemCreateResponse,
152
+ type ItemCreateParams as ItemCreateParams,
153
+ type ItemUpdateParams as ItemUpdateParams,
154
+ type ItemDeleteParams as ItemDeleteParams,
155
+ };
156
+ }
@@ -0,0 +1,19 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Groups,
5
+ type GroupProduct,
6
+ type ProductCollectionGroupDetails,
7
+ type ProductCollectionGroupResponse,
8
+ type GroupCreateParams,
9
+ type GroupUpdateParams,
10
+ type GroupDeleteParams,
11
+ } from './groups';
12
+ export {
13
+ Items,
14
+ type ProductCollectionProduct,
15
+ type ItemCreateResponse,
16
+ type ItemCreateParams,
17
+ type ItemUpdateParams,
18
+ type ItemDeleteParams,
19
+ } from './items';
@@ -0,0 +1,135 @@
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';
7
+ import { APIPromise } from '../../../core/api-promise';
8
+ import { buildHeaders } from '../../../internal/headers';
9
+ import { RequestOptions } from '../../../internal/request-options';
10
+ import { path } from '../../../internal/utils/path';
11
+
12
+ export class Items extends APIResource {
13
+ create(
14
+ groupID: string,
15
+ params: ItemCreateParams,
16
+ options?: RequestOptions,
17
+ ): APIPromise<ItemCreateResponse> {
18
+ const { id, ...body } = params;
19
+ return this._client.post(path`/product-collections/${id}/groups/${groupID}/items`, { body, ...options });
20
+ }
21
+
22
+ update(itemID: string, params: ItemUpdateParams, options?: RequestOptions): APIPromise<void> {
23
+ const { id, group_id, ...body } = params;
24
+ return this._client.patch(path`/product-collections/${id}/groups/${group_id}/items/${itemID}`, {
25
+ body,
26
+ ...options,
27
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
28
+ });
29
+ }
30
+
31
+ delete(itemID: string, params: ItemDeleteParams, options?: RequestOptions): APIPromise<void> {
32
+ const { id, group_id } = params;
33
+ return this._client.delete(path`/product-collections/${id}/groups/${group_id}/items/${itemID}`, {
34
+ ...options,
35
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
36
+ });
37
+ }
38
+ }
39
+
40
+ export interface ProductCollectionProduct {
41
+ id: string;
42
+
43
+ addons_count: number;
44
+
45
+ files_count: number;
46
+
47
+ /**
48
+ * Whether this product has any credit entitlements attached
49
+ */
50
+ has_credit_entitlements: boolean;
51
+
52
+ is_recurring: boolean;
53
+
54
+ license_key_enabled: boolean;
55
+
56
+ meters_count: number;
57
+
58
+ product_id: string;
59
+
60
+ status: boolean;
61
+
62
+ currency?: MiscAPI.Currency | null;
63
+
64
+ description?: string | null;
65
+
66
+ name?: string | null;
67
+
68
+ price?: number | null;
69
+
70
+ /**
71
+ * One-time price details.
72
+ */
73
+ price_detail?: ProductsAPI.Price | null;
74
+
75
+ /**
76
+ * Represents the different categories of taxation applicable to various products
77
+ * and services.
78
+ */
79
+ tax_category?: MiscAPI.TaxCategory | null;
80
+
81
+ tax_inclusive?: boolean | null;
82
+ }
83
+
84
+ export type ItemCreateResponse = Array<ProductCollectionProduct>;
85
+
86
+ export interface ItemCreateParams {
87
+ /**
88
+ * Path param: Product Collection Id
89
+ */
90
+ id: string;
91
+
92
+ /**
93
+ * Body param: Products to add to the group
94
+ */
95
+ products: Array<GroupsAPI.GroupProduct>;
96
+ }
97
+
98
+ export interface ItemUpdateParams {
99
+ /**
100
+ * Path param: Product Collection Id
101
+ */
102
+ id: string;
103
+
104
+ /**
105
+ * Path param: Product Collection Group Id
106
+ */
107
+ group_id: string;
108
+
109
+ /**
110
+ * Body param: Status of the product in the group
111
+ */
112
+ status: boolean;
113
+ }
114
+
115
+ export interface ItemDeleteParams {
116
+ /**
117
+ * Product Collection Id
118
+ */
119
+ id: string;
120
+
121
+ /**
122
+ * Product Collection Group Id
123
+ */
124
+ group_id: string;
125
+ }
126
+
127
+ export declare namespace Items {
128
+ export {
129
+ type ProductCollectionProduct as ProductCollectionProduct,
130
+ type ItemCreateResponse as ItemCreateResponse,
131
+ type ItemCreateParams as ItemCreateParams,
132
+ type ItemUpdateParams as ItemUpdateParams,
133
+ type ItemDeleteParams as ItemDeleteParams,
134
+ };
135
+ }
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export * from './groups/index';
@@ -0,0 +1,23 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Groups,
5
+ type GroupProduct,
6
+ type ProductCollectionGroupDetails,
7
+ type ProductCollectionGroupResponse,
8
+ type GroupCreateParams,
9
+ type GroupUpdateParams,
10
+ type GroupDeleteParams,
11
+ } from './groups/index';
12
+ export {
13
+ ProductCollections,
14
+ type ProductCollection,
15
+ type ProductCollectionListResponse,
16
+ type ProductCollectionUnarchiveResponse,
17
+ type ProductCollectionUpdateImagesResponse,
18
+ type ProductCollectionCreateParams,
19
+ type ProductCollectionUpdateParams,
20
+ type ProductCollectionListParams,
21
+ type ProductCollectionUpdateImagesParams,
22
+ type ProductCollectionListResponsesDefaultPageNumberPagination,
23
+ } from './product-collections';
@@ -0,0 +1,278 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import * as GroupsAPI from './groups/groups';
5
+ import {
6
+ GroupCreateParams,
7
+ GroupDeleteParams,
8
+ GroupProduct,
9
+ GroupUpdateParams,
10
+ Groups,
11
+ ProductCollectionGroupDetails,
12
+ ProductCollectionGroupResponse,
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(body: ProductCollectionCreateParams, options?: RequestOptions): APIPromise<ProductCollection> {
28
+ return this._client.post('/product-collections', { body, ...options });
29
+ }
30
+
31
+ retrieve(id: string, options?: RequestOptions): APIPromise<ProductCollection> {
32
+ return this._client.get(path`/product-collections/${id}`, options);
33
+ }
34
+
35
+ update(id: string, body: ProductCollectionUpdateParams, options?: RequestOptions): APIPromise<void> {
36
+ return this._client.patch(path`/product-collections/${id}`, {
37
+ body,
38
+ ...options,
39
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
40
+ });
41
+ }
42
+
43
+ list(
44
+ query: ProductCollectionListParams | null | undefined = {},
45
+ options?: RequestOptions,
46
+ ): PagePromise<ProductCollectionListResponsesDefaultPageNumberPagination, ProductCollectionListResponse> {
47
+ return this._client.getAPIList(
48
+ '/product-collections',
49
+ DefaultPageNumberPagination<ProductCollectionListResponse>,
50
+ { query, ...options },
51
+ );
52
+ }
53
+
54
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
55
+ return this._client.delete(path`/product-collections/${id}`, {
56
+ ...options,
57
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
58
+ });
59
+ }
60
+
61
+ unarchive(id: string, options?: RequestOptions): APIPromise<ProductCollectionUnarchiveResponse> {
62
+ return this._client.post(path`/product-collections/${id}/unarchive`, options);
63
+ }
64
+
65
+ updateImages(
66
+ id: string,
67
+ params: ProductCollectionUpdateImagesParams | null | undefined = {},
68
+ options?: RequestOptions,
69
+ ): APIPromise<ProductCollectionUpdateImagesResponse> {
70
+ const { force_update } = params ?? {};
71
+ return this._client.put(path`/product-collections/${id}/images`, { query: { force_update }, ...options });
72
+ }
73
+ }
74
+
75
+ export type ProductCollectionListResponsesDefaultPageNumberPagination =
76
+ DefaultPageNumberPagination<ProductCollectionListResponse>;
77
+
78
+ export interface ProductCollection {
79
+ /**
80
+ * Unique identifier for the product collection
81
+ */
82
+ id: string;
83
+
84
+ /**
85
+ * Brand ID for the collection
86
+ */
87
+ brand_id: string;
88
+
89
+ /**
90
+ * Timestamp when the collection was created
91
+ */
92
+ created_at: string;
93
+
94
+ /**
95
+ * Groups in this collection
96
+ */
97
+ groups: Array<GroupsAPI.ProductCollectionGroupResponse>;
98
+
99
+ /**
100
+ * Name of the collection
101
+ */
102
+ name: string;
103
+
104
+ /**
105
+ * Timestamp when the collection was last updated
106
+ */
107
+ updated_at: string;
108
+
109
+ /**
110
+ * Description of the collection
111
+ */
112
+ description?: string | null;
113
+
114
+ /**
115
+ * URL of the collection image
116
+ */
117
+ image?: string | null;
118
+ }
119
+
120
+ export interface ProductCollectionListResponse {
121
+ /**
122
+ * Collection ID
123
+ */
124
+ id: string;
125
+
126
+ /**
127
+ * Timestamp when created
128
+ */
129
+ created_at: string;
130
+
131
+ /**
132
+ * Collection name
133
+ */
134
+ name: string;
135
+
136
+ /**
137
+ * Number of products in the collection
138
+ */
139
+ products_count: number;
140
+
141
+ /**
142
+ * Timestamp when last updated
143
+ */
144
+ updated_at: string;
145
+
146
+ /**
147
+ * Collection description
148
+ */
149
+ description?: string | null;
150
+
151
+ /**
152
+ * Collection image URL
153
+ */
154
+ image?: string | null;
155
+ }
156
+
157
+ export interface ProductCollectionUnarchiveResponse {
158
+ /**
159
+ * Collection ID that was unarchived
160
+ */
161
+ collection_id: string;
162
+
163
+ /**
164
+ * Product IDs that were excluded because they are archived
165
+ */
166
+ excluded_product_ids: Array<string>;
167
+
168
+ /**
169
+ * Success message
170
+ */
171
+ message: string;
172
+ }
173
+
174
+ export interface ProductCollectionUpdateImagesResponse {
175
+ /**
176
+ * Presigned S3 URL for uploading the image
177
+ */
178
+ url: string;
179
+
180
+ /**
181
+ * Optional image ID (present when force_update is true)
182
+ */
183
+ image_id?: string | null;
184
+ }
185
+
186
+ export interface ProductCollectionCreateParams {
187
+ /**
188
+ * Groups of products in this collection
189
+ */
190
+ groups: Array<GroupsAPI.ProductCollectionGroupDetails>;
191
+
192
+ /**
193
+ * Name of the product collection
194
+ */
195
+ name: string;
196
+
197
+ /**
198
+ * Brand id for the collection, if not provided will default to primary brand
199
+ */
200
+ brand_id?: string | null;
201
+
202
+ /**
203
+ * Optional description of the product collection
204
+ */
205
+ description?: string | null;
206
+ }
207
+
208
+ export interface ProductCollectionUpdateParams {
209
+ /**
210
+ * Optional brand_id update
211
+ */
212
+ brand_id?: string | null;
213
+
214
+ /**
215
+ * Optional description update - pass null to remove, omit to keep unchanged
216
+ */
217
+ description?: string | null;
218
+
219
+ /**
220
+ * Optional new order for groups (array of group UUIDs in desired order)
221
+ */
222
+ group_order?: Array<string> | null;
223
+
224
+ /**
225
+ * Optional image update - pass null to remove, omit to keep unchanged
226
+ */
227
+ image_id?: string | null;
228
+
229
+ /**
230
+ * Optional new name for the collection
231
+ */
232
+ name?: string | null;
233
+ }
234
+
235
+ export interface ProductCollectionListParams extends DefaultPageNumberPaginationParams {
236
+ /**
237
+ * List archived collections
238
+ */
239
+ archived?: boolean;
240
+
241
+ /**
242
+ * Filter by Brand id
243
+ */
244
+ brand_id?: string;
245
+ }
246
+
247
+ export interface ProductCollectionUpdateImagesParams {
248
+ /**
249
+ * If true, generates a new image ID to force cache invalidation
250
+ */
251
+ force_update?: boolean | null;
252
+ }
253
+
254
+ ProductCollections.Groups = Groups;
255
+
256
+ export declare namespace ProductCollections {
257
+ export {
258
+ type ProductCollection as ProductCollection,
259
+ type ProductCollectionListResponse as ProductCollectionListResponse,
260
+ type ProductCollectionUnarchiveResponse as ProductCollectionUnarchiveResponse,
261
+ type ProductCollectionUpdateImagesResponse as ProductCollectionUpdateImagesResponse,
262
+ type ProductCollectionListResponsesDefaultPageNumberPagination as ProductCollectionListResponsesDefaultPageNumberPagination,
263
+ type ProductCollectionCreateParams as ProductCollectionCreateParams,
264
+ type ProductCollectionUpdateParams as ProductCollectionUpdateParams,
265
+ type ProductCollectionListParams as ProductCollectionListParams,
266
+ type ProductCollectionUpdateImagesParams as ProductCollectionUpdateImagesParams,
267
+ };
268
+
269
+ export {
270
+ Groups as Groups,
271
+ type GroupProduct as GroupProduct,
272
+ type ProductCollectionGroupDetails as ProductCollectionGroupDetails,
273
+ type ProductCollectionGroupResponse as ProductCollectionGroupResponse,
274
+ type GroupCreateParams as GroupCreateParams,
275
+ type GroupUpdateParams as GroupUpdateParams,
276
+ type GroupDeleteParams as GroupDeleteParams,
277
+ };
278
+ }
@@ -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';