@stigg/typescript 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (317) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +40 -0
  3. package/client.d.mts +6 -8
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +6 -8
  6. package/client.d.ts.map +1 -1
  7. package/client.js +23 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +24 -22
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +11 -5
  12. package/core/pagination.d.mts.map +1 -1
  13. package/core/pagination.d.ts +11 -5
  14. package/core/pagination.d.ts.map +1 -1
  15. package/core/pagination.js +9 -9
  16. package/core/pagination.js.map +1 -1
  17. package/core/pagination.mjs +9 -9
  18. package/core/pagination.mjs.map +1 -1
  19. package/internal/parse.d.mts.map +1 -1
  20. package/internal/parse.d.ts.map +1 -1
  21. package/internal/parse.js +5 -0
  22. package/internal/parse.js.map +1 -1
  23. package/internal/parse.mjs +5 -0
  24. package/internal/parse.mjs.map +1 -1
  25. package/internal/qs/formats.d.mts +7 -0
  26. package/internal/qs/formats.d.mts.map +1 -0
  27. package/internal/qs/formats.d.ts +7 -0
  28. package/internal/qs/formats.d.ts.map +1 -0
  29. package/internal/qs/formats.js +13 -0
  30. package/internal/qs/formats.js.map +1 -0
  31. package/internal/qs/formats.mjs +9 -0
  32. package/internal/qs/formats.mjs.map +1 -0
  33. package/internal/qs/index.d.mts +10 -0
  34. package/internal/qs/index.d.mts.map +1 -0
  35. package/internal/qs/index.d.ts +10 -0
  36. package/internal/qs/index.d.ts.map +1 -0
  37. package/internal/qs/index.js +14 -0
  38. package/internal/qs/index.js.map +1 -0
  39. package/internal/qs/index.mjs +10 -0
  40. package/internal/qs/index.mjs.map +1 -0
  41. package/internal/qs/stringify.d.mts +3 -0
  42. package/internal/qs/stringify.d.mts.map +1 -0
  43. package/internal/qs/stringify.d.ts +3 -0
  44. package/internal/qs/stringify.d.ts.map +1 -0
  45. package/internal/qs/stringify.js +277 -0
  46. package/internal/qs/stringify.js.map +1 -0
  47. package/internal/qs/stringify.mjs +274 -0
  48. package/internal/qs/stringify.mjs.map +1 -0
  49. package/internal/qs/types.d.mts +57 -0
  50. package/internal/qs/types.d.mts.map +1 -0
  51. package/internal/qs/types.d.ts +57 -0
  52. package/internal/qs/types.d.ts.map +1 -0
  53. package/internal/qs/types.js +3 -0
  54. package/internal/qs/types.js.map +1 -0
  55. package/internal/qs/types.mjs +2 -0
  56. package/internal/qs/types.mjs.map +1 -0
  57. package/internal/qs/utils.d.mts +15 -0
  58. package/internal/qs/utils.d.mts.map +1 -0
  59. package/internal/qs/utils.d.ts +15 -0
  60. package/internal/qs/utils.d.ts.map +1 -0
  61. package/internal/qs/utils.js +230 -0
  62. package/internal/qs/utils.js.map +1 -0
  63. package/internal/qs/utils.mjs +217 -0
  64. package/internal/qs/utils.mjs.map +1 -0
  65. package/package.json +1 -1
  66. package/resources/index.d.mts +1 -1
  67. package/resources/index.d.mts.map +1 -1
  68. package/resources/index.d.ts +1 -1
  69. package/resources/index.d.ts.map +1 -1
  70. package/resources/index.js.map +1 -1
  71. package/resources/index.mjs +1 -1
  72. package/resources/index.mjs.map +1 -1
  73. package/resources/v1/addons/addons.d.mts +1298 -0
  74. package/resources/v1/addons/addons.d.mts.map +1 -0
  75. package/resources/v1/addons/addons.d.ts +1298 -0
  76. package/resources/v1/addons/addons.d.ts.map +1 -0
  77. package/resources/v1/addons/addons.js +78 -0
  78. package/resources/v1/addons/addons.js.map +1 -0
  79. package/resources/v1/addons/addons.mjs +73 -0
  80. package/resources/v1/addons/addons.mjs.map +1 -0
  81. package/resources/v1/addons/entitlements.d.mts +747 -0
  82. package/resources/v1/addons/entitlements.d.mts.map +1 -0
  83. package/resources/v1/addons/entitlements.d.ts +747 -0
  84. package/resources/v1/addons/entitlements.d.ts.map +1 -0
  85. package/resources/v1/addons/entitlements.js +36 -0
  86. package/resources/v1/addons/entitlements.js.map +1 -0
  87. package/resources/v1/addons/entitlements.mjs +32 -0
  88. package/resources/v1/addons/entitlements.mjs.map +1 -0
  89. package/resources/v1/addons/index.d.mts +3 -0
  90. package/resources/v1/addons/index.d.mts.map +1 -0
  91. package/resources/v1/addons/index.d.ts +3 -0
  92. package/resources/v1/addons/index.d.ts.map +1 -0
  93. package/resources/v1/addons/index.js +9 -0
  94. package/resources/v1/addons/index.js.map +1 -0
  95. package/resources/v1/addons/index.mjs +4 -0
  96. package/resources/v1/addons/index.mjs.map +1 -0
  97. package/resources/v1/addons.d.mts +2 -0
  98. package/resources/v1/addons.d.mts.map +1 -0
  99. package/resources/v1/addons.d.ts +2 -0
  100. package/resources/v1/addons.d.ts.map +1 -0
  101. package/resources/v1/addons.js +6 -0
  102. package/resources/v1/addons.js.map +1 -0
  103. package/resources/v1/addons.mjs +3 -0
  104. package/resources/v1/addons.mjs.map +1 -0
  105. package/resources/v1/coupons.d.mts +154 -157
  106. package/resources/v1/coupons.d.mts.map +1 -1
  107. package/resources/v1/coupons.d.ts +154 -157
  108. package/resources/v1/coupons.d.ts.map +1 -1
  109. package/resources/v1/coupons.js +21 -4
  110. package/resources/v1/coupons.js.map +1 -1
  111. package/resources/v1/coupons.mjs +21 -4
  112. package/resources/v1/coupons.mjs.map +1 -1
  113. package/resources/v1/customers/customers.d.mts +247 -118
  114. package/resources/v1/customers/customers.d.mts.map +1 -1
  115. package/resources/v1/customers/customers.d.ts +247 -118
  116. package/resources/v1/customers/customers.d.ts.map +1 -1
  117. package/resources/v1/customers/customers.js +37 -16
  118. package/resources/v1/customers/customers.js.map +1 -1
  119. package/resources/v1/customers/customers.mjs +37 -16
  120. package/resources/v1/customers/customers.mjs.map +1 -1
  121. package/resources/v1/customers/index.d.mts +2 -2
  122. package/resources/v1/customers/index.d.mts.map +1 -1
  123. package/resources/v1/customers/index.d.ts +2 -2
  124. package/resources/v1/customers/index.d.ts.map +1 -1
  125. package/resources/v1/customers/index.js +3 -3
  126. package/resources/v1/customers/index.js.map +1 -1
  127. package/resources/v1/customers/index.mjs +1 -1
  128. package/resources/v1/customers/index.mjs.map +1 -1
  129. package/resources/v1/customers/payment-method.d.mts +7 -2
  130. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  131. package/resources/v1/customers/payment-method.d.ts +7 -2
  132. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  133. package/resources/v1/customers/payment-method.js +4 -2
  134. package/resources/v1/customers/payment-method.js.map +1 -1
  135. package/resources/v1/customers/payment-method.mjs +4 -2
  136. package/resources/v1/customers/payment-method.mjs.map +1 -1
  137. package/resources/v1/customers/promotional-entitlements.d.mts +498 -0
  138. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
  139. package/resources/v1/customers/promotional-entitlements.d.ts +498 -0
  140. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
  141. package/resources/v1/customers/promotional-entitlements.js +32 -0
  142. package/resources/v1/customers/promotional-entitlements.js.map +1 -0
  143. package/resources/v1/customers/promotional-entitlements.mjs +28 -0
  144. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
  145. package/resources/v1/events.d.mts +63 -0
  146. package/resources/v1/events.d.mts.map +1 -0
  147. package/resources/v1/events.d.ts +63 -0
  148. package/resources/v1/events.d.ts.map +1 -0
  149. package/resources/v1/events.js +16 -0
  150. package/resources/v1/events.js.map +1 -0
  151. package/resources/v1/events.mjs +12 -0
  152. package/resources/v1/events.mjs.map +1 -0
  153. package/resources/v1/features.d.mts +444 -0
  154. package/resources/v1/features.d.mts.map +1 -0
  155. package/resources/v1/features.d.ts +444 -0
  156. package/resources/v1/features.d.ts.map +1 -0
  157. package/resources/v1/features.js +51 -0
  158. package/resources/v1/features.js.map +1 -0
  159. package/resources/v1/features.mjs +47 -0
  160. package/resources/v1/features.mjs.map +1 -0
  161. package/resources/v1/index.d.mts +10 -4
  162. package/resources/v1/index.d.mts.map +1 -1
  163. package/resources/v1/index.d.ts +10 -4
  164. package/resources/v1/index.d.ts.map +1 -1
  165. package/resources/v1/index.js +17 -5
  166. package/resources/v1/index.js.map +1 -1
  167. package/resources/v1/index.mjs +7 -1
  168. package/resources/v1/index.mjs.map +1 -1
  169. package/resources/v1/plans/entitlements.d.mts +747 -0
  170. package/resources/v1/plans/entitlements.d.mts.map +1 -0
  171. package/resources/v1/plans/entitlements.d.ts +747 -0
  172. package/resources/v1/plans/entitlements.d.ts.map +1 -0
  173. package/resources/v1/plans/entitlements.js +36 -0
  174. package/resources/v1/plans/entitlements.js.map +1 -0
  175. package/resources/v1/plans/entitlements.mjs +32 -0
  176. package/resources/v1/plans/entitlements.mjs.map +1 -0
  177. package/resources/v1/plans/index.d.mts +3 -0
  178. package/resources/v1/plans/index.d.mts.map +1 -0
  179. package/resources/v1/plans/index.d.ts +3 -0
  180. package/resources/v1/plans/index.d.ts.map +1 -0
  181. package/resources/v1/plans/index.js +9 -0
  182. package/resources/v1/plans/index.js.map +1 -0
  183. package/resources/v1/plans/index.mjs +4 -0
  184. package/resources/v1/plans/index.mjs.map +1 -0
  185. package/resources/v1/plans/plans.d.mts +973 -0
  186. package/resources/v1/plans/plans.d.mts.map +1 -0
  187. package/resources/v1/plans/plans.d.ts +973 -0
  188. package/resources/v1/plans/plans.d.ts.map +1 -0
  189. package/resources/v1/plans/plans.js +76 -0
  190. package/resources/v1/plans/plans.js.map +1 -0
  191. package/resources/v1/plans/plans.mjs +71 -0
  192. package/resources/v1/plans/plans.mjs.map +1 -0
  193. package/resources/v1/plans.d.mts +2 -0
  194. package/resources/v1/plans.d.mts.map +1 -0
  195. package/resources/v1/plans.d.ts +2 -0
  196. package/resources/v1/plans.d.ts.map +1 -0
  197. package/resources/v1/plans.js +6 -0
  198. package/resources/v1/plans.js.map +1 -0
  199. package/resources/v1/plans.mjs +3 -0
  200. package/resources/v1/plans.mjs.map +1 -0
  201. package/resources/v1/products.d.mts +332 -0
  202. package/resources/v1/products.d.mts.map +1 -0
  203. package/resources/v1/products.d.ts +332 -0
  204. package/resources/v1/products.d.ts.map +1 -0
  205. package/resources/v1/products.js +52 -0
  206. package/resources/v1/products.js.map +1 -0
  207. package/resources/v1/products.mjs +48 -0
  208. package/resources/v1/products.mjs.map +1 -0
  209. package/resources/v1/subscriptions/future-update.d.mts +12 -19
  210. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  211. package/resources/v1/subscriptions/future-update.d.ts +12 -19
  212. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  213. package/resources/v1/subscriptions/future-update.js +3 -2
  214. package/resources/v1/subscriptions/future-update.js.map +1 -1
  215. package/resources/v1/subscriptions/future-update.mjs +3 -2
  216. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  217. package/resources/v1/subscriptions/index.d.mts +4 -2
  218. package/resources/v1/subscriptions/index.d.mts.map +1 -1
  219. package/resources/v1/subscriptions/index.d.ts +4 -2
  220. package/resources/v1/subscriptions/index.d.ts.map +1 -1
  221. package/resources/v1/subscriptions/index.js +5 -1
  222. package/resources/v1/subscriptions/index.js.map +1 -1
  223. package/resources/v1/subscriptions/index.mjs +3 -1
  224. package/resources/v1/subscriptions/index.mjs.map +1 -1
  225. package/resources/v1/subscriptions/invoice.d.mts +34 -0
  226. package/resources/v1/subscriptions/invoice.d.mts.map +1 -0
  227. package/resources/v1/subscriptions/invoice.d.ts +34 -0
  228. package/resources/v1/subscriptions/invoice.d.ts.map +1 -0
  229. package/resources/v1/subscriptions/invoice.js +17 -0
  230. package/resources/v1/subscriptions/invoice.js.map +1 -0
  231. package/resources/v1/subscriptions/invoice.mjs +13 -0
  232. package/resources/v1/subscriptions/invoice.mjs.map +1 -0
  233. package/resources/v1/subscriptions/subscriptions.d.mts +1565 -518
  234. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  235. package/resources/v1/subscriptions/subscriptions.d.ts +1565 -518
  236. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  237. package/resources/v1/subscriptions/subscriptions.js +52 -12
  238. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  239. package/resources/v1/subscriptions/subscriptions.mjs +53 -13
  240. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  241. package/resources/v1/subscriptions/usage.d.mts +98 -0
  242. package/resources/v1/subscriptions/usage.d.mts.map +1 -0
  243. package/resources/v1/subscriptions/usage.d.ts +98 -0
  244. package/resources/v1/subscriptions/usage.d.ts.map +1 -0
  245. package/resources/v1/subscriptions/usage.js +24 -0
  246. package/resources/v1/subscriptions/usage.js.map +1 -0
  247. package/resources/v1/subscriptions/usage.mjs +20 -0
  248. package/resources/v1/subscriptions/usage.mjs.map +1 -0
  249. package/resources/v1/usage.d.mts +230 -0
  250. package/resources/v1/usage.d.mts.map +1 -0
  251. package/resources/v1/usage.d.ts +230 -0
  252. package/resources/v1/usage.d.ts.map +1 -0
  253. package/resources/v1/usage.js +24 -0
  254. package/resources/v1/usage.js.map +1 -0
  255. package/resources/v1/usage.mjs +20 -0
  256. package/resources/v1/usage.mjs.map +1 -0
  257. package/resources/v1/v1.d.mts +30 -149
  258. package/resources/v1/v1.d.mts.map +1 -1
  259. package/resources/v1/v1.d.ts +30 -149
  260. package/resources/v1/v1.d.ts.map +1 -1
  261. package/resources/v1/v1.js +24 -12
  262. package/resources/v1/v1.js.map +1 -1
  263. package/resources/v1/v1.mjs +24 -12
  264. package/resources/v1/v1.mjs.map +1 -1
  265. package/src/client.ts +33 -40
  266. package/src/core/pagination.ts +24 -18
  267. package/src/internal/parse.ts +6 -0
  268. package/src/internal/qs/LICENSE.md +13 -0
  269. package/src/internal/qs/README.md +3 -0
  270. package/src/internal/qs/formats.ts +10 -0
  271. package/src/internal/qs/index.ts +13 -0
  272. package/src/internal/qs/stringify.ts +385 -0
  273. package/src/internal/qs/types.ts +71 -0
  274. package/src/internal/qs/utils.ts +265 -0
  275. package/src/resources/index.ts +1 -7
  276. package/src/resources/v1/addons/addons.ts +3245 -0
  277. package/src/resources/v1/addons/entitlements.ts +976 -0
  278. package/src/resources/v1/addons/index.ts +26 -0
  279. package/src/resources/v1/addons.ts +3 -0
  280. package/src/resources/v1/coupons.ts +311 -436
  281. package/src/resources/v1/customers/customers.ts +334 -153
  282. package/src/resources/v1/customers/index.ts +17 -2
  283. package/src/resources/v1/customers/payment-method.ts +7 -2
  284. package/src/resources/v1/customers/promotional-entitlements.ts +669 -0
  285. package/src/resources/v1/events.ts +74 -0
  286. package/src/resources/v1/features.ts +571 -0
  287. package/src/resources/v1/index.ts +73 -15
  288. package/src/resources/v1/plans/entitlements.ts +968 -0
  289. package/src/resources/v1/plans/index.ts +24 -0
  290. package/src/resources/v1/plans/plans.ts +2032 -0
  291. package/src/resources/v1/plans.ts +3 -0
  292. package/src/resources/v1/products.ts +423 -0
  293. package/src/resources/v1/subscriptions/future-update.ts +12 -27
  294. package/src/resources/v1/subscriptions/index.ts +16 -11
  295. package/src/resources/v1/subscriptions/invoice.ts +42 -0
  296. package/src/resources/v1/subscriptions/subscriptions.ts +3341 -832
  297. package/src/resources/v1/subscriptions/usage.ts +126 -0
  298. package/src/resources/v1/usage.ts +284 -0
  299. package/src/resources/v1/v1.ts +174 -197
  300. package/src/version.ts +1 -1
  301. package/version.d.mts +1 -1
  302. package/version.d.mts.map +1 -1
  303. package/version.d.ts +1 -1
  304. package/version.d.ts.map +1 -1
  305. package/version.js +1 -1
  306. package/version.js.map +1 -1
  307. package/version.mjs +1 -1
  308. package/version.mjs.map +1 -1
  309. package/resources/v1/customers/usage.d.mts +0 -98
  310. package/resources/v1/customers/usage.d.mts.map +0 -1
  311. package/resources/v1/customers/usage.d.ts +0 -98
  312. package/resources/v1/customers/usage.d.ts.map +0 -1
  313. package/resources/v1/customers/usage.js +0 -20
  314. package/resources/v1/customers/usage.js.map +0 -1
  315. package/resources/v1/customers/usage.mjs +0 -16
  316. package/resources/v1/customers/usage.mjs.map +0 -1
  317. package/src/resources/v1/customers/usage.ts +0 -132
@@ -3,67 +3,121 @@
3
3
  import { APIResource } from '../../../core/resource';
4
4
  import * as PaymentMethodAPI from './payment-method';
5
5
  import { PaymentMethod, PaymentMethodAttachParams } from './payment-method';
6
- import * as UsageAPI from './usage';
7
- import { Usage, UsageRetrieveParams, UsageRetrieveResponse } from './usage';
6
+ import * as PromotionalEntitlementsAPI from './promotional-entitlements';
7
+ import {
8
+ PromotionalEntitlementCreateParams,
9
+ PromotionalEntitlementCreateResponse,
10
+ PromotionalEntitlementListParams,
11
+ PromotionalEntitlementListResponse,
12
+ PromotionalEntitlementListResponsesMyCursorIDPage,
13
+ PromotionalEntitlementRevokeParams,
14
+ PromotionalEntitlementRevokeResponse,
15
+ PromotionalEntitlements,
16
+ } from './promotional-entitlements';
8
17
  import { APIPromise } from '../../../core/api-promise';
18
+ import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
9
19
  import { RequestOptions } from '../../../internal/request-options';
10
20
  import { path } from '../../../internal/utils/path';
11
21
 
12
22
  export class Customers extends APIResource {
13
23
  paymentMethod: PaymentMethodAPI.PaymentMethod = new PaymentMethodAPI.PaymentMethod(this._client);
14
- usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
24
+ promotionalEntitlements: PromotionalEntitlementsAPI.PromotionalEntitlements =
25
+ new PromotionalEntitlementsAPI.PromotionalEntitlements(this._client);
15
26
 
16
27
  /**
17
- * Create a new Customer
18
- */
19
- create(body: CustomerCreateParams, options?: RequestOptions): APIPromise<CustomerResponse> {
20
- return this._client.post('/api/v1/customers', { body, ...options });
21
- }
22
-
23
- /**
24
- * Get a single Customer by id
28
+ * Retrieves a customer by their unique identifier, including billing information
29
+ * and subscription status.
25
30
  */
26
31
  retrieve(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
27
32
  return this._client.get(path`/api/v1/customers/${id}`, options);
28
33
  }
29
34
 
30
35
  /**
31
- * Update an existing Customer
36
+ * Updates an existing customer's properties such as name, email, and billing
37
+ * information.
32
38
  */
33
39
  update(id: string, body: CustomerUpdateParams, options?: RequestOptions): APIPromise<CustomerResponse> {
34
40
  return this._client.patch(path`/api/v1/customers/${id}`, { body, ...options });
35
41
  }
36
42
 
37
43
  /**
38
- * Get a list of Customers
44
+ * Retrieves a paginated list of customers in the environment.
39
45
  */
40
46
  list(
41
47
  query: CustomerListParams | null | undefined = {},
42
48
  options?: RequestOptions,
43
- ): APIPromise<CustomerListResponse> {
44
- return this._client.get('/api/v1/customers', { query, ...options });
49
+ ): PagePromise<CustomerListResponsesMyCursorIDPage, CustomerListResponse> {
50
+ return this._client.getAPIList('/api/v1/customers', MyCursorIDPage<CustomerListResponse>, {
51
+ query,
52
+ ...options,
53
+ });
45
54
  }
46
55
 
47
56
  /**
48
- * Perform archive on a Customer
57
+ * Archives a customer, preventing new subscriptions. Optionally cancels existing
58
+ * subscriptions.
49
59
  */
50
60
  archive(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
51
61
  return this._client.post(path`/api/v1/customers/${id}/archive`, options);
52
62
  }
53
63
 
54
64
  /**
55
- * Perform unarchive on a Customer
65
+ * Imports multiple customers in bulk. Used for migrating customer data from
66
+ * external systems.
67
+ */
68
+ import(body: CustomerImportParams, options?: RequestOptions): APIPromise<CustomerImportResponse> {
69
+ return this._client.post('/api/v1/customers/import', { body, ...options });
70
+ }
71
+
72
+ /**
73
+ * Retrieves a paginated list of resources within the same customer.
74
+ */
75
+ listResources(
76
+ id: string,
77
+ query: CustomerListResourcesParams | null | undefined = {},
78
+ options?: RequestOptions,
79
+ ): PagePromise<CustomerListResourcesResponsesMyCursorIDPage, CustomerListResourcesResponse> {
80
+ return this._client.getAPIList(
81
+ path`/api/v1/customers/${id}/resources`,
82
+ MyCursorIDPage<CustomerListResourcesResponse>,
83
+ { query, ...options },
84
+ );
85
+ }
86
+
87
+ /**
88
+ * Creates a new customer and optionally provisions an initial subscription in a
89
+ * single operation.
90
+ */
91
+ provision(body: CustomerProvisionParams, options?: RequestOptions): APIPromise<CustomerResponse> {
92
+ return this._client.post('/api/v1/customers', { body, ...options });
93
+ }
94
+
95
+ /**
96
+ * Restores an archived customer, allowing them to create new subscriptions again.
56
97
  */
57
98
  unarchive(id: string, options?: RequestOptions): APIPromise<CustomerResponse> {
58
99
  return this._client.post(path`/api/v1/customers/${id}/unarchive`, options);
59
100
  }
60
101
  }
61
102
 
103
+ export type CustomerListResponsesMyCursorIDPage = MyCursorIDPage<CustomerListResponse>;
104
+
105
+ export type CustomerListResourcesResponsesMyCursorIDPage = MyCursorIDPage<CustomerListResourcesResponse>;
106
+
107
+ /**
108
+ * Response object
109
+ */
62
110
  export interface CustomerResponse {
111
+ /**
112
+ * A customer can be either an organization or an individual
113
+ */
63
114
  data: CustomerResponse.Data;
64
115
  }
65
116
 
66
117
  export namespace CustomerResponse {
118
+ /**
119
+ * A customer can be either an organization or an individual
120
+ */
67
121
  export interface Data {
68
122
  /**
69
123
  * Customer slug
@@ -147,128 +201,9 @@ export namespace CustomerResponse {
147
201
  type: 'CARD' | 'BANK' | 'CASH_APP';
148
202
  }
149
203
 
150
- export interface Integration {
151
- /**
152
- * Integration details
153
- */
154
- id: string;
155
-
156
- /**
157
- * Synced entity id
158
- */
159
- syncedEntityId: string | null;
160
-
161
- /**
162
- * The vendor identifier of integration
163
- */
164
- vendorIdentifier:
165
- | 'AUTH0'
166
- | 'ZUORA'
167
- | 'STRIPE'
168
- | 'HUBSPOT'
169
- | 'AWS_MARKETPLACE'
170
- | 'SNOWFLAKE'
171
- | 'SALESFORCE'
172
- | 'BIG_QUERY'
173
- | 'OPEN_FGA'
174
- | 'APP_STORE';
175
- }
176
- }
177
- }
178
-
179
- export interface CustomerListResponse {
180
- data: Array<CustomerListResponse.Data>;
181
- }
182
-
183
- export namespace CustomerListResponse {
184
- export interface Data {
185
- /**
186
- * Customer slug
187
- */
188
- id: string;
189
-
190
- /**
191
- * Timestamp of when the record was deleted
192
- */
193
- archivedAt: string | null;
194
-
195
- /**
196
- * Timestamp of when the record was created
197
- */
198
- createdAt: string;
199
-
200
- /**
201
- * Cursor ID for query pagination
202
- */
203
- cursorId: string;
204
-
205
204
  /**
206
- * Timestamp of when the record was last updated
205
+ * External billing or CRM integration link
207
206
  */
208
- updatedAt: string;
209
-
210
- /**
211
- * Customer level coupon
212
- */
213
- couponId?: string | null;
214
-
215
- /**
216
- * The default payment method details
217
- */
218
- defaultPaymentMethod?: Data.DefaultPaymentMethod | null;
219
-
220
- /**
221
- * The email of the customer
222
- */
223
- email?: string | null;
224
-
225
- /**
226
- * List of integrations
227
- */
228
- integrations?: Array<Data.Integration>;
229
-
230
- /**
231
- * Additional metadata
232
- */
233
- metadata?: { [key: string]: string };
234
-
235
- /**
236
- * The name of the customer
237
- */
238
- name?: string | null;
239
- }
240
-
241
- export namespace Data {
242
- /**
243
- * The default payment method details
244
- */
245
- export interface DefaultPaymentMethod {
246
- /**
247
- * The default payment method id
248
- */
249
- billingId: string | null;
250
-
251
- /**
252
- * The expiration month of the default payment method
253
- */
254
- cardExpiryMonth: number | null;
255
-
256
- /**
257
- * The expiration year of the default payment method
258
- */
259
- cardExpiryYear: number | null;
260
-
261
- /**
262
- * The last 4 digits of the default payment method
263
- */
264
- cardLast4Digits: string | null;
265
-
266
- /**
267
- * The default payment method type
268
- */
269
- type: 'CARD' | 'BANK' | 'CASH_APP';
270
- }
271
-
272
207
  export interface Integration {
273
208
  /**
274
209
  * Integration details
@@ -298,12 +233,30 @@ export namespace CustomerListResponse {
298
233
  }
299
234
  }
300
235
 
301
- export interface CustomerCreateParams {
236
+ /**
237
+ * A customer can be either an organization or an individual
238
+ */
239
+ export interface CustomerListResponse {
302
240
  /**
303
241
  * Customer slug
304
242
  */
305
243
  id: string;
306
244
 
245
+ /**
246
+ * Timestamp of when the record was deleted
247
+ */
248
+ archivedAt: string | null;
249
+
250
+ /**
251
+ * Timestamp of when the record was created
252
+ */
253
+ createdAt: string;
254
+
255
+ /**
256
+ * Timestamp of when the record was last updated
257
+ */
258
+ updatedAt: string;
259
+
307
260
  /**
308
261
  * Customer level coupon
309
262
  */
@@ -312,7 +265,7 @@ export interface CustomerCreateParams {
312
265
  /**
313
266
  * The default payment method details
314
267
  */
315
- defaultPaymentMethod?: CustomerCreateParams.DefaultPaymentMethod | null;
268
+ defaultPaymentMethod?: CustomerListResponse.DefaultPaymentMethod | null;
316
269
 
317
270
  /**
318
271
  * The email of the customer
@@ -322,7 +275,7 @@ export interface CustomerCreateParams {
322
275
  /**
323
276
  * List of integrations
324
277
  */
325
- integrations?: Array<CustomerCreateParams.Integration>;
278
+ integrations?: Array<CustomerListResponse.Integration>;
326
279
 
327
280
  /**
328
281
  * Additional metadata
@@ -335,7 +288,7 @@ export interface CustomerCreateParams {
335
288
  name?: string | null;
336
289
  }
337
290
 
338
- export namespace CustomerCreateParams {
291
+ export namespace CustomerListResponse {
339
292
  /**
340
293
  * The default payment method details
341
294
  */
@@ -366,6 +319,9 @@ export namespace CustomerCreateParams {
366
319
  type: 'CARD' | 'BANK' | 'CASH_APP';
367
320
  }
368
321
 
322
+ /**
323
+ * External billing or CRM integration link
324
+ */
369
325
  export interface Integration {
370
326
  /**
371
327
  * Integration details
@@ -394,6 +350,48 @@ export namespace CustomerCreateParams {
394
350
  }
395
351
  }
396
352
 
353
+ /**
354
+ * Response object
355
+ */
356
+ export interface CustomerImportResponse {
357
+ /**
358
+ * List of newly created customer IDs from the import operation.
359
+ */
360
+ data: CustomerImportResponse.Data;
361
+ }
362
+
363
+ export namespace CustomerImportResponse {
364
+ /**
365
+ * List of newly created customer IDs from the import operation.
366
+ */
367
+ export interface Data {
368
+ /**
369
+ * Customer IDs created during import
370
+ */
371
+ newCustomers: Array<string>;
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Resource object that belongs to a customer
377
+ */
378
+ export interface CustomerListResourcesResponse {
379
+ /**
380
+ * Resource slug
381
+ */
382
+ id: string;
383
+
384
+ /**
385
+ * Timestamp of when the record was created
386
+ */
387
+ createdAt: string;
388
+
389
+ /**
390
+ * Timestamp of when the record was last updated
391
+ */
392
+ updatedAt: string;
393
+ }
394
+
397
395
  export interface CustomerUpdateParams {
398
396
  /**
399
397
  * Customer level coupon
@@ -422,6 +420,9 @@ export interface CustomerUpdateParams {
422
420
  }
423
421
 
424
422
  export namespace CustomerUpdateParams {
423
+ /**
424
+ * External billing or CRM integration link
425
+ */
425
426
  export interface Integration {
426
427
  /**
427
428
  * Integration details
@@ -450,40 +451,220 @@ export namespace CustomerUpdateParams {
450
451
  }
451
452
  }
452
453
 
453
- export interface CustomerListParams {
454
+ export interface CustomerListParams extends MyCursorIDPageParams {
454
455
  /**
455
- * Ending before this UUID for pagination
456
+ * Filter by creation date using range operators: gt, gte, lt, lte
456
457
  */
457
- endingBefore?: string;
458
+ createdAt?: CustomerListParams.CreatedAt;
458
459
 
459
460
  /**
460
- * Items per page
461
+ * Filter by exact customer email address
461
462
  */
462
- limit?: number;
463
+ email?: string;
463
464
 
464
465
  /**
465
- * Starting after this UUID for pagination
466
+ * Filter by exact customer name
466
467
  */
467
- startingAfter?: string;
468
+ name?: string;
469
+ }
470
+
471
+ export namespace CustomerListParams {
472
+ /**
473
+ * Filter by creation date using range operators: gt, gte, lt, lte
474
+ */
475
+ export interface CreatedAt {
476
+ /**
477
+ * Greater than the specified createdAt value
478
+ */
479
+ gt?: string;
480
+
481
+ /**
482
+ * Greater than or equal to the specified createdAt value
483
+ */
484
+ gte?: string;
485
+
486
+ /**
487
+ * Less than the specified createdAt value
488
+ */
489
+ lt?: string;
490
+
491
+ /**
492
+ * Less than or equal to the specified createdAt value
493
+ */
494
+ lte?: string;
495
+ }
496
+ }
497
+
498
+ export interface CustomerImportParams {
499
+ /**
500
+ * List of customer objects to import
501
+ */
502
+ customers: Array<CustomerImportParams.Customer>;
503
+ }
504
+
505
+ export namespace CustomerImportParams {
506
+ export interface Customer {
507
+ /**
508
+ * Customer slug
509
+ */
510
+ id: string;
511
+
512
+ /**
513
+ * The email of the customer
514
+ */
515
+ email: string | null;
516
+
517
+ /**
518
+ * The name of the customer
519
+ */
520
+ name: string | null;
521
+
522
+ /**
523
+ * Additional metadata
524
+ */
525
+ metadata?: { [key: string]: string };
526
+
527
+ /**
528
+ * Billing provider payment method id
529
+ */
530
+ paymentMethodId?: string;
531
+
532
+ /**
533
+ * Timestamp of when the record was last updated
534
+ */
535
+ updatedAt?: string;
536
+ }
537
+ }
538
+
539
+ export interface CustomerListResourcesParams extends MyCursorIDPageParams {}
540
+
541
+ export interface CustomerProvisionParams {
542
+ /**
543
+ * Customer slug
544
+ */
545
+ id: string;
546
+
547
+ /**
548
+ * Customer level coupon
549
+ */
550
+ couponId?: string | null;
551
+
552
+ /**
553
+ * The default payment method details
554
+ */
555
+ defaultPaymentMethod?: CustomerProvisionParams.DefaultPaymentMethod | null;
556
+
557
+ /**
558
+ * The email of the customer
559
+ */
560
+ email?: string | null;
561
+
562
+ /**
563
+ * List of integrations
564
+ */
565
+ integrations?: Array<CustomerProvisionParams.Integration>;
566
+
567
+ /**
568
+ * Additional metadata
569
+ */
570
+ metadata?: { [key: string]: string };
571
+
572
+ /**
573
+ * The name of the customer
574
+ */
575
+ name?: string | null;
576
+ }
577
+
578
+ export namespace CustomerProvisionParams {
579
+ /**
580
+ * The default payment method details
581
+ */
582
+ export interface DefaultPaymentMethod {
583
+ /**
584
+ * The default payment method id
585
+ */
586
+ billingId: string | null;
587
+
588
+ /**
589
+ * The expiration month of the default payment method
590
+ */
591
+ cardExpiryMonth: number | null;
592
+
593
+ /**
594
+ * The expiration year of the default payment method
595
+ */
596
+ cardExpiryYear: number | null;
597
+
598
+ /**
599
+ * The last 4 digits of the default payment method
600
+ */
601
+ cardLast4Digits: string | null;
602
+
603
+ /**
604
+ * The default payment method type
605
+ */
606
+ type: 'CARD' | 'BANK' | 'CASH_APP';
607
+ }
608
+
609
+ /**
610
+ * External billing or CRM integration link
611
+ */
612
+ export interface Integration {
613
+ /**
614
+ * Integration details
615
+ */
616
+ id: string;
617
+
618
+ /**
619
+ * Synced entity id
620
+ */
621
+ syncedEntityId: string | null;
622
+
623
+ /**
624
+ * The vendor identifier of integration
625
+ */
626
+ vendorIdentifier:
627
+ | 'AUTH0'
628
+ | 'ZUORA'
629
+ | 'STRIPE'
630
+ | 'HUBSPOT'
631
+ | 'AWS_MARKETPLACE'
632
+ | 'SNOWFLAKE'
633
+ | 'SALESFORCE'
634
+ | 'BIG_QUERY'
635
+ | 'OPEN_FGA'
636
+ | 'APP_STORE';
637
+ }
468
638
  }
469
639
 
470
640
  Customers.PaymentMethod = PaymentMethod;
471
- Customers.Usage = Usage;
641
+ Customers.PromotionalEntitlements = PromotionalEntitlements;
472
642
 
473
643
  export declare namespace Customers {
474
644
  export {
475
645
  type CustomerResponse as CustomerResponse,
476
646
  type CustomerListResponse as CustomerListResponse,
477
- type CustomerCreateParams as CustomerCreateParams,
647
+ type CustomerImportResponse as CustomerImportResponse,
648
+ type CustomerListResourcesResponse as CustomerListResourcesResponse,
649
+ type CustomerListResponsesMyCursorIDPage as CustomerListResponsesMyCursorIDPage,
650
+ type CustomerListResourcesResponsesMyCursorIDPage as CustomerListResourcesResponsesMyCursorIDPage,
478
651
  type CustomerUpdateParams as CustomerUpdateParams,
479
652
  type CustomerListParams as CustomerListParams,
653
+ type CustomerImportParams as CustomerImportParams,
654
+ type CustomerListResourcesParams as CustomerListResourcesParams,
655
+ type CustomerProvisionParams as CustomerProvisionParams,
480
656
  };
481
657
 
482
658
  export { PaymentMethod as PaymentMethod, type PaymentMethodAttachParams as PaymentMethodAttachParams };
483
659
 
484
660
  export {
485
- Usage as Usage,
486
- type UsageRetrieveResponse as UsageRetrieveResponse,
487
- type UsageRetrieveParams as UsageRetrieveParams,
661
+ PromotionalEntitlements as PromotionalEntitlements,
662
+ type PromotionalEntitlementCreateResponse as PromotionalEntitlementCreateResponse,
663
+ type PromotionalEntitlementListResponse as PromotionalEntitlementListResponse,
664
+ type PromotionalEntitlementRevokeResponse as PromotionalEntitlementRevokeResponse,
665
+ type PromotionalEntitlementListResponsesMyCursorIDPage as PromotionalEntitlementListResponsesMyCursorIDPage,
666
+ type PromotionalEntitlementCreateParams as PromotionalEntitlementCreateParams,
667
+ type PromotionalEntitlementListParams as PromotionalEntitlementListParams,
668
+ type PromotionalEntitlementRevokeParams as PromotionalEntitlementRevokeParams,
488
669
  };
489
670
  }
@@ -4,9 +4,24 @@ export {
4
4
  Customers,
5
5
  type CustomerResponse,
6
6
  type CustomerListResponse,
7
- type CustomerCreateParams,
7
+ type CustomerImportResponse,
8
+ type CustomerListResourcesResponse,
8
9
  type CustomerUpdateParams,
9
10
  type CustomerListParams,
11
+ type CustomerImportParams,
12
+ type CustomerListResourcesParams,
13
+ type CustomerProvisionParams,
14
+ type CustomerListResponsesMyCursorIDPage,
15
+ type CustomerListResourcesResponsesMyCursorIDPage,
10
16
  } from './customers';
11
17
  export { PaymentMethod, type PaymentMethodAttachParams } from './payment-method';
12
- export { Usage, type UsageRetrieveResponse, type UsageRetrieveParams } from './usage';
18
+ export {
19
+ PromotionalEntitlements,
20
+ type PromotionalEntitlementCreateResponse,
21
+ type PromotionalEntitlementListResponse,
22
+ type PromotionalEntitlementRevokeResponse,
23
+ type PromotionalEntitlementCreateParams,
24
+ type PromotionalEntitlementListParams,
25
+ type PromotionalEntitlementRevokeParams,
26
+ type PromotionalEntitlementListResponsesMyCursorIDPage,
27
+ } from './promotional-entitlements';
@@ -8,7 +8,8 @@ import { path } from '../../../internal/utils/path';
8
8
 
9
9
  export class PaymentMethod extends APIResource {
10
10
  /**
11
- * Perform payment-method attachment on a Customer
11
+ * Attaches a payment method to a customer for billing. Required for paid
12
+ * subscriptions when integrated with a billing provider.
12
13
  */
13
14
  attach(
14
15
  id: string,
@@ -19,7 +20,8 @@ export class PaymentMethod extends APIResource {
19
20
  }
20
21
 
21
22
  /**
22
- * Perform payment-method detachment on a Customer
23
+ * Removes the payment method from a customer. Ensure active paid subscriptions
24
+ * have an alternative payment method.
23
25
  */
24
26
  detach(id: string, options?: RequestOptions): APIPromise<CustomersAPI.CustomerResponse> {
25
27
  return this._client.delete(path`/api/v1/customers/${id}/payment-method`, options);
@@ -52,6 +54,9 @@ export interface PaymentMethodAttachParams {
52
54
  | 'OPEN_FGA'
53
55
  | 'APP_STORE';
54
56
 
57
+ /**
58
+ * Customers selected currency
59
+ */
55
60
  billingCurrency?:
56
61
  | 'usd'
57
62
  | 'aed'