@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
@@ -2,448 +2,70 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import { APIPromise } from '../../core/api-promise';
5
+ import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../core/pagination';
5
6
  import { RequestOptions } from '../../internal/request-options';
6
7
  import { path } from '../../internal/utils/path';
7
8
 
8
9
  export class Coupons extends APIResource {
9
10
  /**
10
- * Create a new Coupon
11
+ * Creates a new discount coupon with percentage or fixed amount off, applicable to
12
+ * customer subscriptions.
11
13
  */
12
- create(body: CouponCreateParams, options?: RequestOptions): APIPromise<CouponCreateResponse> {
14
+ create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon> {
13
15
  return this._client.post('/api/v1/coupons', { body, ...options });
14
16
  }
15
17
 
16
18
  /**
17
- * Get a single Coupon by id
19
+ * Retrieves a coupon by its unique identifier.
18
20
  */
19
- retrieve(id: string, options?: RequestOptions): APIPromise<CouponRetrieveResponse> {
21
+ retrieve(id: string, options?: RequestOptions): APIPromise<Coupon> {
20
22
  return this._client.get(path`/api/v1/coupons/${id}`, options);
21
23
  }
22
24
 
23
25
  /**
24
- * Get a list of Coupons
26
+ * Retrieves a paginated list of coupons in the environment.
25
27
  */
26
28
  list(
27
29
  query: CouponListParams | null | undefined = {},
28
30
  options?: RequestOptions,
29
- ): APIPromise<CouponListResponse> {
30
- return this._client.get('/api/v1/coupons', { query, ...options });
31
+ ): PagePromise<CouponListResponsesMyCursorIDPage, CouponListResponse> {
32
+ return this._client.getAPIList('/api/v1/coupons', MyCursorIDPage<CouponListResponse>, {
33
+ query,
34
+ ...options,
35
+ });
31
36
  }
32
- }
33
-
34
- export interface CouponCreateResponse {
35
- data: CouponCreateResponse.Data;
36
- }
37
-
38
- export namespace CouponCreateResponse {
39
- export interface Data {
40
- /**
41
- * The unique identifier for the entity
42
- */
43
- id: string;
44
-
45
- /**
46
- * Fixed amount discounts in different currencies
47
- */
48
- amountsOff: Array<Data.AmountsOff> | null;
49
-
50
- /**
51
- * The unique identifier for the entity in the billing provider
52
- */
53
- billingId: string | null;
54
-
55
- /**
56
- * The URL to the entity in the billing provider
57
- */
58
- billingLinkUrl: string | null;
59
-
60
- /**
61
- * Timestamp of when the record was created
62
- */
63
- createdAt: string;
64
-
65
- /**
66
- * Description of the coupon
67
- */
68
- description: string | null;
69
-
70
- /**
71
- * Duration of the coupon validity in months
72
- */
73
- durationInMonths: number | null;
74
-
75
- /**
76
- * Name of the coupon
77
- */
78
- name: string;
79
-
80
- /**
81
- * Percentage discount off the original price
82
- */
83
- percentOff: number | null;
84
-
85
- /**
86
- * The source of the coupon
87
- */
88
- source: 'STIGG' | 'STIGG_ADHOC' | 'STRIPE' | null;
89
-
90
- /**
91
- * Current status of the coupon
92
- */
93
- status: 'ACTIVE' | 'ARCHIVED';
94
-
95
- /**
96
- * Type of the coupon (percentage or fixed amount)
97
- */
98
- type: 'FIXED' | 'PERCENTAGE';
99
-
100
- /**
101
- * Timestamp of when the record was last updated
102
- */
103
- updatedAt: string;
104
- }
105
-
106
- export namespace Data {
107
- export interface AmountsOff {
108
- /**
109
- * The price amount
110
- */
111
- amount: number;
112
-
113
- /**
114
- * The price currency
115
- */
116
- currency:
117
- | 'usd'
118
- | 'aed'
119
- | 'all'
120
- | 'amd'
121
- | 'ang'
122
- | 'aud'
123
- | 'awg'
124
- | 'azn'
125
- | 'bam'
126
- | 'bbd'
127
- | 'bdt'
128
- | 'bgn'
129
- | 'bif'
130
- | 'bmd'
131
- | 'bnd'
132
- | 'bsd'
133
- | 'bwp'
134
- | 'byn'
135
- | 'bzd'
136
- | 'brl'
137
- | 'cad'
138
- | 'cdf'
139
- | 'chf'
140
- | 'cny'
141
- | 'czk'
142
- | 'dkk'
143
- | 'dop'
144
- | 'dzd'
145
- | 'egp'
146
- | 'etb'
147
- | 'eur'
148
- | 'fjd'
149
- | 'gbp'
150
- | 'gel'
151
- | 'gip'
152
- | 'gmd'
153
- | 'gyd'
154
- | 'hkd'
155
- | 'hrk'
156
- | 'htg'
157
- | 'idr'
158
- | 'ils'
159
- | 'inr'
160
- | 'isk'
161
- | 'jmd'
162
- | 'jpy'
163
- | 'kes'
164
- | 'kgs'
165
- | 'khr'
166
- | 'kmf'
167
- | 'krw'
168
- | 'kyd'
169
- | 'kzt'
170
- | 'lbp'
171
- | 'lkr'
172
- | 'lrd'
173
- | 'lsl'
174
- | 'mad'
175
- | 'mdl'
176
- | 'mga'
177
- | 'mkd'
178
- | 'mmk'
179
- | 'mnt'
180
- | 'mop'
181
- | 'mro'
182
- | 'mvr'
183
- | 'mwk'
184
- | 'mxn'
185
- | 'myr'
186
- | 'mzn'
187
- | 'nad'
188
- | 'ngn'
189
- | 'nok'
190
- | 'npr'
191
- | 'nzd'
192
- | 'pgk'
193
- | 'php'
194
- | 'pkr'
195
- | 'pln'
196
- | 'qar'
197
- | 'ron'
198
- | 'rsd'
199
- | 'rub'
200
- | 'rwf'
201
- | 'sar'
202
- | 'sbd'
203
- | 'scr'
204
- | 'sek'
205
- | 'sgd'
206
- | 'sle'
207
- | 'sll'
208
- | 'sos'
209
- | 'szl'
210
- | 'thb'
211
- | 'tjs'
212
- | 'top'
213
- | 'try'
214
- | 'ttd'
215
- | 'tzs'
216
- | 'uah'
217
- | 'uzs'
218
- | 'vnd'
219
- | 'vuv'
220
- | 'wst'
221
- | 'xaf'
222
- | 'xcd'
223
- | 'yer'
224
- | 'zar'
225
- | 'zmw'
226
- | 'clp'
227
- | 'djf'
228
- | 'gnf'
229
- | 'ugx'
230
- | 'pyg'
231
- | 'xof'
232
- | 'xpf'
233
- | null;
234
- }
235
- }
236
- }
237
-
238
- export interface CouponRetrieveResponse {
239
- data: CouponRetrieveResponse.Data;
240
- }
241
-
242
- export namespace CouponRetrieveResponse {
243
- export interface Data {
244
- /**
245
- * The unique identifier for the entity
246
- */
247
- id: string;
248
-
249
- /**
250
- * Fixed amount discounts in different currencies
251
- */
252
- amountsOff: Array<Data.AmountsOff> | null;
253
-
254
- /**
255
- * The unique identifier for the entity in the billing provider
256
- */
257
- billingId: string | null;
258
-
259
- /**
260
- * The URL to the entity in the billing provider
261
- */
262
- billingLinkUrl: string | null;
263
-
264
- /**
265
- * Timestamp of when the record was created
266
- */
267
- createdAt: string;
268
-
269
- /**
270
- * Description of the coupon
271
- */
272
- description: string | null;
273
-
274
- /**
275
- * Duration of the coupon validity in months
276
- */
277
- durationInMonths: number | null;
278
-
279
- /**
280
- * Name of the coupon
281
- */
282
- name: string;
283
-
284
- /**
285
- * Percentage discount off the original price
286
- */
287
- percentOff: number | null;
288
-
289
- /**
290
- * The source of the coupon
291
- */
292
- source: 'STIGG' | 'STIGG_ADHOC' | 'STRIPE' | null;
293
-
294
- /**
295
- * Current status of the coupon
296
- */
297
- status: 'ACTIVE' | 'ARCHIVED';
298
-
299
- /**
300
- * Type of the coupon (percentage or fixed amount)
301
- */
302
- type: 'FIXED' | 'PERCENTAGE';
303
-
304
- /**
305
- * Timestamp of when the record was last updated
306
- */
307
- updatedAt: string;
308
- }
309
-
310
- export namespace Data {
311
- export interface AmountsOff {
312
- /**
313
- * The price amount
314
- */
315
- amount: number;
316
-
317
- /**
318
- * The price currency
319
- */
320
- currency:
321
- | 'usd'
322
- | 'aed'
323
- | 'all'
324
- | 'amd'
325
- | 'ang'
326
- | 'aud'
327
- | 'awg'
328
- | 'azn'
329
- | 'bam'
330
- | 'bbd'
331
- | 'bdt'
332
- | 'bgn'
333
- | 'bif'
334
- | 'bmd'
335
- | 'bnd'
336
- | 'bsd'
337
- | 'bwp'
338
- | 'byn'
339
- | 'bzd'
340
- | 'brl'
341
- | 'cad'
342
- | 'cdf'
343
- | 'chf'
344
- | 'cny'
345
- | 'czk'
346
- | 'dkk'
347
- | 'dop'
348
- | 'dzd'
349
- | 'egp'
350
- | 'etb'
351
- | 'eur'
352
- | 'fjd'
353
- | 'gbp'
354
- | 'gel'
355
- | 'gip'
356
- | 'gmd'
357
- | 'gyd'
358
- | 'hkd'
359
- | 'hrk'
360
- | 'htg'
361
- | 'idr'
362
- | 'ils'
363
- | 'inr'
364
- | 'isk'
365
- | 'jmd'
366
- | 'jpy'
367
- | 'kes'
368
- | 'kgs'
369
- | 'khr'
370
- | 'kmf'
371
- | 'krw'
372
- | 'kyd'
373
- | 'kzt'
374
- | 'lbp'
375
- | 'lkr'
376
- | 'lrd'
377
- | 'lsl'
378
- | 'mad'
379
- | 'mdl'
380
- | 'mga'
381
- | 'mkd'
382
- | 'mmk'
383
- | 'mnt'
384
- | 'mop'
385
- | 'mro'
386
- | 'mvr'
387
- | 'mwk'
388
- | 'mxn'
389
- | 'myr'
390
- | 'mzn'
391
- | 'nad'
392
- | 'ngn'
393
- | 'nok'
394
- | 'npr'
395
- | 'nzd'
396
- | 'pgk'
397
- | 'php'
398
- | 'pkr'
399
- | 'pln'
400
- | 'qar'
401
- | 'ron'
402
- | 'rsd'
403
- | 'rub'
404
- | 'rwf'
405
- | 'sar'
406
- | 'sbd'
407
- | 'scr'
408
- | 'sek'
409
- | 'sgd'
410
- | 'sle'
411
- | 'sll'
412
- | 'sos'
413
- | 'szl'
414
- | 'thb'
415
- | 'tjs'
416
- | 'top'
417
- | 'try'
418
- | 'ttd'
419
- | 'tzs'
420
- | 'uah'
421
- | 'uzs'
422
- | 'vnd'
423
- | 'vuv'
424
- | 'wst'
425
- | 'xaf'
426
- | 'xcd'
427
- | 'yer'
428
- | 'zar'
429
- | 'zmw'
430
- | 'clp'
431
- | 'djf'
432
- | 'gnf'
433
- | 'ugx'
434
- | 'pyg'
435
- | 'xof'
436
- | 'xpf'
437
- | null;
438
- }
37
+
38
+ /**
39
+ * Archives a coupon, preventing it from being applied to new subscriptions.
40
+ */
41
+ archiveCoupon(id: string, options?: RequestOptions): APIPromise<Coupon> {
42
+ return this._client.post(path`/api/v1/coupons/${id}/archive`, options);
43
+ }
44
+
45
+ /**
46
+ * Updates an existing coupon's properties such as name, description, and metadata.
47
+ */
48
+ updateCoupon(id: string, body: CouponUpdateCouponParams, options?: RequestOptions): APIPromise<Coupon> {
49
+ return this._client.patch(path`/api/v1/coupons/${id}`, { body, ...options });
439
50
  }
440
51
  }
441
52
 
442
- export interface CouponListResponse {
443
- data: Array<CouponListResponse.Data>;
53
+ export type CouponListResponsesMyCursorIDPage = MyCursorIDPage<CouponListResponse>;
54
+
55
+ /**
56
+ * Response object
57
+ */
58
+ export interface Coupon {
59
+ /**
60
+ * Discount instrument with percentage or fixed amount
61
+ */
62
+ data: Coupon.Data;
444
63
  }
445
64
 
446
- export namespace CouponListResponse {
65
+ export namespace Coupon {
66
+ /**
67
+ * Discount instrument with percentage or fixed amount
68
+ */
447
69
  export interface Data {
448
70
  /**
449
71
  * The unique identifier for the entity
@@ -470,11 +92,6 @@ export namespace CouponListResponse {
470
92
  */
471
93
  createdAt: string;
472
94
 
473
- /**
474
- * Cursor ID for query pagination
475
- */
476
- cursorId: string;
477
-
478
95
  /**
479
96
  * Description of the coupon
480
97
  */
@@ -517,6 +134,9 @@ export namespace CouponListResponse {
517
134
  }
518
135
 
519
136
  export namespace Data {
137
+ /**
138
+ * Monetary amount with currency
139
+ */
520
140
  export interface AmountsOff {
521
141
  /**
522
142
  * The price amount
@@ -642,13 +262,15 @@ export namespace CouponListResponse {
642
262
  | 'ugx'
643
263
  | 'pyg'
644
264
  | 'xof'
645
- | 'xpf'
646
- | null;
265
+ | 'xpf';
647
266
  }
648
267
  }
649
268
  }
650
269
 
651
- export interface CouponCreateParams {
270
+ /**
271
+ * Discount instrument with percentage or fixed amount
272
+ */
273
+ export interface CouponListResponse {
652
274
  /**
653
275
  * The unique identifier for the entity
654
276
  */
@@ -657,7 +279,22 @@ export interface CouponCreateParams {
657
279
  /**
658
280
  * Fixed amount discounts in different currencies
659
281
  */
660
- amountsOff: Array<CouponCreateParams.AmountsOff> | null;
282
+ amountsOff: Array<CouponListResponse.AmountsOff> | null;
283
+
284
+ /**
285
+ * The unique identifier for the entity in the billing provider
286
+ */
287
+ billingId: string | null;
288
+
289
+ /**
290
+ * The URL to the entity in the billing provider
291
+ */
292
+ billingLinkUrl: string | null;
293
+
294
+ /**
295
+ * Timestamp of when the record was created
296
+ */
297
+ createdAt: string;
661
298
 
662
299
  /**
663
300
  * Description of the coupon
@@ -679,13 +316,201 @@ export interface CouponCreateParams {
679
316
  */
680
317
  percentOff: number | null;
681
318
 
319
+ /**
320
+ * The source of the coupon
321
+ */
322
+ source: 'STIGG' | 'STIGG_ADHOC' | 'STRIPE' | null;
323
+
324
+ /**
325
+ * Current status of the coupon
326
+ */
327
+ status: 'ACTIVE' | 'ARCHIVED';
328
+
329
+ /**
330
+ * Type of the coupon (percentage or fixed amount)
331
+ */
332
+ type: 'FIXED' | 'PERCENTAGE';
333
+
334
+ /**
335
+ * Timestamp of when the record was last updated
336
+ */
337
+ updatedAt: string;
338
+ }
339
+
340
+ export namespace CouponListResponse {
341
+ /**
342
+ * Monetary amount with currency
343
+ */
344
+ export interface AmountsOff {
345
+ /**
346
+ * The price amount
347
+ */
348
+ amount: number;
349
+
350
+ /**
351
+ * The price currency
352
+ */
353
+ currency:
354
+ | 'usd'
355
+ | 'aed'
356
+ | 'all'
357
+ | 'amd'
358
+ | 'ang'
359
+ | 'aud'
360
+ | 'awg'
361
+ | 'azn'
362
+ | 'bam'
363
+ | 'bbd'
364
+ | 'bdt'
365
+ | 'bgn'
366
+ | 'bif'
367
+ | 'bmd'
368
+ | 'bnd'
369
+ | 'bsd'
370
+ | 'bwp'
371
+ | 'byn'
372
+ | 'bzd'
373
+ | 'brl'
374
+ | 'cad'
375
+ | 'cdf'
376
+ | 'chf'
377
+ | 'cny'
378
+ | 'czk'
379
+ | 'dkk'
380
+ | 'dop'
381
+ | 'dzd'
382
+ | 'egp'
383
+ | 'etb'
384
+ | 'eur'
385
+ | 'fjd'
386
+ | 'gbp'
387
+ | 'gel'
388
+ | 'gip'
389
+ | 'gmd'
390
+ | 'gyd'
391
+ | 'hkd'
392
+ | 'hrk'
393
+ | 'htg'
394
+ | 'idr'
395
+ | 'ils'
396
+ | 'inr'
397
+ | 'isk'
398
+ | 'jmd'
399
+ | 'jpy'
400
+ | 'kes'
401
+ | 'kgs'
402
+ | 'khr'
403
+ | 'kmf'
404
+ | 'krw'
405
+ | 'kyd'
406
+ | 'kzt'
407
+ | 'lbp'
408
+ | 'lkr'
409
+ | 'lrd'
410
+ | 'lsl'
411
+ | 'mad'
412
+ | 'mdl'
413
+ | 'mga'
414
+ | 'mkd'
415
+ | 'mmk'
416
+ | 'mnt'
417
+ | 'mop'
418
+ | 'mro'
419
+ | 'mvr'
420
+ | 'mwk'
421
+ | 'mxn'
422
+ | 'myr'
423
+ | 'mzn'
424
+ | 'nad'
425
+ | 'ngn'
426
+ | 'nok'
427
+ | 'npr'
428
+ | 'nzd'
429
+ | 'pgk'
430
+ | 'php'
431
+ | 'pkr'
432
+ | 'pln'
433
+ | 'qar'
434
+ | 'ron'
435
+ | 'rsd'
436
+ | 'rub'
437
+ | 'rwf'
438
+ | 'sar'
439
+ | 'sbd'
440
+ | 'scr'
441
+ | 'sek'
442
+ | 'sgd'
443
+ | 'sle'
444
+ | 'sll'
445
+ | 'sos'
446
+ | 'szl'
447
+ | 'thb'
448
+ | 'tjs'
449
+ | 'top'
450
+ | 'try'
451
+ | 'ttd'
452
+ | 'tzs'
453
+ | 'uah'
454
+ | 'uzs'
455
+ | 'vnd'
456
+ | 'vuv'
457
+ | 'wst'
458
+ | 'xaf'
459
+ | 'xcd'
460
+ | 'yer'
461
+ | 'zar'
462
+ | 'zmw'
463
+ | 'clp'
464
+ | 'djf'
465
+ | 'gnf'
466
+ | 'ugx'
467
+ | 'pyg'
468
+ | 'xof'
469
+ | 'xpf';
470
+ }
471
+ }
472
+
473
+ export interface CouponCreateParams {
474
+ /**
475
+ * The unique identifier for the entity
476
+ */
477
+ id: string;
478
+
479
+ /**
480
+ * Fixed amount discounts in different currencies
481
+ */
482
+ amountsOff: Array<CouponCreateParams.AmountsOff> | null;
483
+
484
+ /**
485
+ * Description of the coupon
486
+ */
487
+ description: string | null;
488
+
489
+ /**
490
+ * Duration of the coupon validity in months
491
+ */
492
+ durationInMonths: number | null;
493
+
682
494
  /**
683
495
  * Metadata associated with the entity
684
496
  */
685
- additionalMetaData?: unknown;
497
+ metadata: { [key: string]: string } | null;
498
+
499
+ /**
500
+ * Name of the coupon
501
+ */
502
+ name: string;
503
+
504
+ /**
505
+ * Percentage discount off the original price
506
+ */
507
+ percentOff: number | null;
686
508
  }
687
509
 
688
510
  export namespace CouponCreateParams {
511
+ /**
512
+ * Monetary amount with currency
513
+ */
689
514
  export interface AmountsOff {
690
515
  /**
691
516
  * The price amount
@@ -815,29 +640,79 @@ export namespace CouponCreateParams {
815
640
  }
816
641
  }
817
642
 
818
- export interface CouponListParams {
643
+ export interface CouponListParams extends MyCursorIDPageParams {
819
644
  /**
820
- * Ending before this UUID for pagination
645
+ * Filter by entity ID
821
646
  */
822
- endingBefore?: string;
647
+ id?: string;
823
648
 
824
649
  /**
825
- * Items per page
650
+ * Filter by creation date using range operators: gt, gte, lt, lte
826
651
  */
827
- limit?: number;
652
+ createdAt?: CouponListParams.CreatedAt;
828
653
 
829
654
  /**
830
- * Starting after this UUID for pagination
655
+ * Filter by coupon status. Supports comma-separated values for multiple statuses
656
+ */
657
+ status?: string;
658
+
659
+ /**
660
+ * Filter by coupon type (FIXED or PERCENTAGE)
661
+ */
662
+ type?: 'FIXED' | 'PERCENTAGE';
663
+ }
664
+
665
+ export namespace CouponListParams {
666
+ /**
667
+ * Filter by creation date using range operators: gt, gte, lt, lte
668
+ */
669
+ export interface CreatedAt {
670
+ /**
671
+ * Greater than the specified createdAt value
672
+ */
673
+ gt?: string;
674
+
675
+ /**
676
+ * Greater than or equal to the specified createdAt value
677
+ */
678
+ gte?: string;
679
+
680
+ /**
681
+ * Less than the specified createdAt value
682
+ */
683
+ lt?: string;
684
+
685
+ /**
686
+ * Less than or equal to the specified createdAt value
687
+ */
688
+ lte?: string;
689
+ }
690
+ }
691
+
692
+ export interface CouponUpdateCouponParams {
693
+ /**
694
+ * Description of the coupon
695
+ */
696
+ description?: string | null;
697
+
698
+ /**
699
+ * Metadata associated with the entity
700
+ */
701
+ metadata?: { [key: string]: string } | null;
702
+
703
+ /**
704
+ * Name of the coupon
831
705
  */
832
- startingAfter?: string;
706
+ name?: string;
833
707
  }
834
708
 
835
709
  export declare namespace Coupons {
836
710
  export {
837
- type CouponCreateResponse as CouponCreateResponse,
838
- type CouponRetrieveResponse as CouponRetrieveResponse,
711
+ type Coupon as Coupon,
839
712
  type CouponListResponse as CouponListResponse,
713
+ type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage,
840
714
  type CouponCreateParams as CouponCreateParams,
841
715
  type CouponListParams as CouponListParams,
716
+ type CouponUpdateCouponParams as CouponUpdateCouponParams,
842
717
  };
843
718
  }