@stigg/typescript 0.1.0-alpha.3 → 0.1.0-alpha.7

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 (204) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +9 -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 +16 -21
  8. package/client.js.map +1 -1
  9. package/client.mjs +17 -22
  10. package/client.mjs.map +1 -1
  11. package/internal/parse.d.mts.map +1 -1
  12. package/internal/parse.d.ts.map +1 -1
  13. package/internal/parse.js +5 -0
  14. package/internal/parse.js.map +1 -1
  15. package/internal/parse.mjs +5 -0
  16. package/internal/parse.mjs.map +1 -1
  17. package/internal/qs/formats.d.mts +7 -0
  18. package/internal/qs/formats.d.mts.map +1 -0
  19. package/internal/qs/formats.d.ts +7 -0
  20. package/internal/qs/formats.d.ts.map +1 -0
  21. package/internal/qs/formats.js +13 -0
  22. package/internal/qs/formats.js.map +1 -0
  23. package/internal/qs/formats.mjs +9 -0
  24. package/internal/qs/formats.mjs.map +1 -0
  25. package/internal/qs/index.d.mts +10 -0
  26. package/internal/qs/index.d.mts.map +1 -0
  27. package/internal/qs/index.d.ts +10 -0
  28. package/internal/qs/index.d.ts.map +1 -0
  29. package/internal/qs/index.js +14 -0
  30. package/internal/qs/index.js.map +1 -0
  31. package/internal/qs/index.mjs +10 -0
  32. package/internal/qs/index.mjs.map +1 -0
  33. package/internal/qs/stringify.d.mts +3 -0
  34. package/internal/qs/stringify.d.mts.map +1 -0
  35. package/internal/qs/stringify.d.ts +3 -0
  36. package/internal/qs/stringify.d.ts.map +1 -0
  37. package/internal/qs/stringify.js +277 -0
  38. package/internal/qs/stringify.js.map +1 -0
  39. package/internal/qs/stringify.mjs +274 -0
  40. package/internal/qs/stringify.mjs.map +1 -0
  41. package/internal/qs/types.d.mts +57 -0
  42. package/internal/qs/types.d.mts.map +1 -0
  43. package/internal/qs/types.d.ts +57 -0
  44. package/internal/qs/types.d.ts.map +1 -0
  45. package/internal/qs/types.js +3 -0
  46. package/internal/qs/types.js.map +1 -0
  47. package/internal/qs/types.mjs +2 -0
  48. package/internal/qs/types.mjs.map +1 -0
  49. package/internal/qs/utils.d.mts +15 -0
  50. package/internal/qs/utils.d.mts.map +1 -0
  51. package/internal/qs/utils.d.ts +15 -0
  52. package/internal/qs/utils.d.ts.map +1 -0
  53. package/internal/qs/utils.js +230 -0
  54. package/internal/qs/utils.js.map +1 -0
  55. package/internal/qs/utils.mjs +217 -0
  56. package/internal/qs/utils.mjs.map +1 -0
  57. package/package.json +1 -1
  58. package/resources/index.d.mts +1 -1
  59. package/resources/index.d.mts.map +1 -1
  60. package/resources/index.d.ts +1 -1
  61. package/resources/index.d.ts.map +1 -1
  62. package/resources/index.js.map +1 -1
  63. package/resources/index.mjs +1 -1
  64. package/resources/index.mjs.map +1 -1
  65. package/resources/v1/coupons.d.mts +55 -96
  66. package/resources/v1/coupons.d.mts.map +1 -1
  67. package/resources/v1/coupons.d.ts +55 -96
  68. package/resources/v1/coupons.d.ts.map +1 -1
  69. package/resources/v1/coupons.js +4 -3
  70. package/resources/v1/coupons.js.map +1 -1
  71. package/resources/v1/coupons.mjs +4 -3
  72. package/resources/v1/coupons.mjs.map +1 -1
  73. package/resources/v1/customers/customers.d.mts +170 -46
  74. package/resources/v1/customers/customers.d.mts.map +1 -1
  75. package/resources/v1/customers/customers.d.ts +170 -46
  76. package/resources/v1/customers/customers.d.ts.map +1 -1
  77. package/resources/v1/customers/customers.js +32 -15
  78. package/resources/v1/customers/customers.js.map +1 -1
  79. package/resources/v1/customers/customers.mjs +32 -15
  80. package/resources/v1/customers/customers.mjs.map +1 -1
  81. package/resources/v1/customers/index.d.mts +2 -2
  82. package/resources/v1/customers/index.d.mts.map +1 -1
  83. package/resources/v1/customers/index.d.ts +2 -2
  84. package/resources/v1/customers/index.d.ts.map +1 -1
  85. package/resources/v1/customers/index.js +3 -3
  86. package/resources/v1/customers/index.js.map +1 -1
  87. package/resources/v1/customers/index.mjs +1 -1
  88. package/resources/v1/customers/index.mjs.map +1 -1
  89. package/resources/v1/customers/payment-method.d.mts +4 -2
  90. package/resources/v1/customers/payment-method.d.mts.map +1 -1
  91. package/resources/v1/customers/payment-method.d.ts +4 -2
  92. package/resources/v1/customers/payment-method.d.ts.map +1 -1
  93. package/resources/v1/customers/payment-method.js +4 -2
  94. package/resources/v1/customers/payment-method.js.map +1 -1
  95. package/resources/v1/customers/payment-method.mjs +4 -2
  96. package/resources/v1/customers/payment-method.mjs.map +1 -1
  97. package/resources/v1/customers/promotional-entitlements.d.mts +352 -0
  98. package/resources/v1/customers/promotional-entitlements.d.mts.map +1 -0
  99. package/resources/v1/customers/promotional-entitlements.d.ts +352 -0
  100. package/resources/v1/customers/promotional-entitlements.d.ts.map +1 -0
  101. package/resources/v1/customers/promotional-entitlements.js +25 -0
  102. package/resources/v1/customers/promotional-entitlements.js.map +1 -0
  103. package/resources/v1/customers/promotional-entitlements.mjs +21 -0
  104. package/resources/v1/customers/promotional-entitlements.mjs.map +1 -0
  105. package/resources/v1/events.d.mts +63 -0
  106. package/resources/v1/events.d.mts.map +1 -0
  107. package/resources/v1/events.d.ts +63 -0
  108. package/resources/v1/events.d.ts.map +1 -0
  109. package/resources/v1/events.js +16 -0
  110. package/resources/v1/events.js.map +1 -0
  111. package/resources/v1/events.mjs +12 -0
  112. package/resources/v1/events.mjs.map +1 -0
  113. package/resources/v1/index.d.mts +7 -4
  114. package/resources/v1/index.d.mts.map +1 -1
  115. package/resources/v1/index.d.ts +7 -4
  116. package/resources/v1/index.d.ts.map +1 -1
  117. package/resources/v1/index.js +7 -1
  118. package/resources/v1/index.js.map +1 -1
  119. package/resources/v1/index.mjs +4 -1
  120. package/resources/v1/index.mjs.map +1 -1
  121. package/resources/v1/products.d.mts +126 -0
  122. package/resources/v1/products.d.mts.map +1 -0
  123. package/resources/v1/products.d.ts +126 -0
  124. package/resources/v1/products.d.ts.map +1 -0
  125. package/resources/v1/products.js +19 -0
  126. package/resources/v1/products.js.map +1 -0
  127. package/resources/v1/products.mjs +15 -0
  128. package/resources/v1/products.mjs.map +1 -0
  129. package/resources/v1/subscriptions/future-update.d.mts +9 -22
  130. package/resources/v1/subscriptions/future-update.d.mts.map +1 -1
  131. package/resources/v1/subscriptions/future-update.d.ts +9 -22
  132. package/resources/v1/subscriptions/future-update.d.ts.map +1 -1
  133. package/resources/v1/subscriptions/future-update.js +3 -2
  134. package/resources/v1/subscriptions/future-update.js.map +1 -1
  135. package/resources/v1/subscriptions/future-update.mjs +3 -2
  136. package/resources/v1/subscriptions/future-update.mjs.map +1 -1
  137. package/resources/v1/subscriptions/index.d.mts +2 -2
  138. package/resources/v1/subscriptions/index.d.mts.map +1 -1
  139. package/resources/v1/subscriptions/index.d.ts +2 -2
  140. package/resources/v1/subscriptions/index.d.ts.map +1 -1
  141. package/resources/v1/subscriptions/index.js.map +1 -1
  142. package/resources/v1/subscriptions/index.mjs +1 -1
  143. package/resources/v1/subscriptions/index.mjs.map +1 -1
  144. package/resources/v1/subscriptions/subscriptions.d.mts +987 -949
  145. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  146. package/resources/v1/subscriptions/subscriptions.d.ts +987 -949
  147. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  148. package/resources/v1/subscriptions/subscriptions.js +39 -11
  149. package/resources/v1/subscriptions/subscriptions.js.map +1 -1
  150. package/resources/v1/subscriptions/subscriptions.mjs +40 -12
  151. package/resources/v1/subscriptions/subscriptions.mjs.map +1 -1
  152. package/resources/v1/usage.d.mts +230 -0
  153. package/resources/v1/usage.d.mts.map +1 -0
  154. package/resources/v1/usage.d.ts +230 -0
  155. package/resources/v1/usage.d.ts.map +1 -0
  156. package/resources/v1/usage.js +24 -0
  157. package/resources/v1/usage.js.map +1 -0
  158. package/resources/v1/usage.mjs +20 -0
  159. package/resources/v1/usage.mjs.map +1 -0
  160. package/resources/v1/v1.d.mts +18 -172
  161. package/resources/v1/v1.d.mts.map +1 -1
  162. package/resources/v1/v1.d.ts +18 -172
  163. package/resources/v1/v1.d.ts.map +1 -1
  164. package/resources/v1/v1.js +12 -12
  165. package/resources/v1/v1.js.map +1 -1
  166. package/resources/v1/v1.mjs +12 -12
  167. package/resources/v1/v1.mjs.map +1 -1
  168. package/src/client.ts +25 -40
  169. package/src/internal/parse.ts +6 -0
  170. package/src/internal/qs/LICENSE.md +13 -0
  171. package/src/internal/qs/README.md +3 -0
  172. package/src/internal/qs/formats.ts +10 -0
  173. package/src/internal/qs/index.ts +13 -0
  174. package/src/internal/qs/stringify.ts +385 -0
  175. package/src/internal/qs/types.ts +71 -0
  176. package/src/internal/qs/utils.ts +265 -0
  177. package/src/resources/index.ts +1 -7
  178. package/src/resources/v1/coupons.ts +63 -231
  179. package/src/resources/v1/customers/customers.ts +234 -60
  180. package/src/resources/v1/customers/index.ts +13 -2
  181. package/src/resources/v1/customers/payment-method.ts +4 -2
  182. package/src/resources/v1/customers/promotional-entitlements.ts +468 -0
  183. package/src/resources/v1/events.ts +74 -0
  184. package/src/resources/v1/index.ts +28 -15
  185. package/src/resources/v1/products.ts +162 -0
  186. package/src/resources/v1/subscriptions/future-update.ts +9 -30
  187. package/src/resources/v1/subscriptions/index.ts +8 -11
  188. package/src/resources/v1/subscriptions/subscriptions.ts +2699 -2280
  189. package/src/resources/v1/usage.ts +284 -0
  190. package/src/resources/v1/v1.ts +72 -220
  191. package/src/version.ts +1 -1
  192. package/version.d.mts +1 -1
  193. package/version.d.ts +1 -1
  194. package/version.js +1 -1
  195. package/version.mjs +1 -1
  196. package/resources/v1/customers/usage.d.mts +0 -4
  197. package/resources/v1/customers/usage.d.mts.map +0 -1
  198. package/resources/v1/customers/usage.d.ts +0 -4
  199. package/resources/v1/customers/usage.d.ts.map +0 -1
  200. package/resources/v1/customers/usage.js +0 -9
  201. package/resources/v1/customers/usage.js.map +0 -1
  202. package/resources/v1/customers/usage.mjs +0 -5
  203. package/resources/v1/customers/usage.mjs.map +0 -1
  204. package/src/resources/v1/customers/usage.ts +0 -5
@@ -0,0 +1,265 @@
1
+ import { RFC1738 } from './formats';
2
+ import type { DefaultEncoder, Format } from './types';
3
+ import { isArray } from '../utils/values';
4
+
5
+ export let has = (obj: object, key: PropertyKey): boolean => (
6
+ (has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
7
+ has(obj, key)
8
+ );
9
+
10
+ const hex_table = /* @__PURE__ */ (() => {
11
+ const array = [];
12
+ for (let i = 0; i < 256; ++i) {
13
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
14
+ }
15
+
16
+ return array;
17
+ })();
18
+
19
+ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
20
+ while (queue.length > 1) {
21
+ const item = queue.pop();
22
+ if (!item) continue;
23
+
24
+ const obj = item.obj[item.prop];
25
+
26
+ if (isArray(obj)) {
27
+ const compacted: unknown[] = [];
28
+
29
+ for (let j = 0; j < obj.length; ++j) {
30
+ if (typeof obj[j] !== 'undefined') {
31
+ compacted.push(obj[j]);
32
+ }
33
+ }
34
+
35
+ // @ts-ignore
36
+ item.obj[item.prop] = compacted;
37
+ }
38
+ }
39
+ }
40
+
41
+ function array_to_object(source: any[], options: { plainObjects: boolean }) {
42
+ const obj = options && options.plainObjects ? Object.create(null) : {};
43
+ for (let i = 0; i < source.length; ++i) {
44
+ if (typeof source[i] !== 'undefined') {
45
+ obj[i] = source[i];
46
+ }
47
+ }
48
+
49
+ return obj;
50
+ }
51
+
52
+ export function merge(
53
+ target: any,
54
+ source: any,
55
+ options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
56
+ ) {
57
+ if (!source) {
58
+ return target;
59
+ }
60
+
61
+ if (typeof source !== 'object') {
62
+ if (isArray(target)) {
63
+ target.push(source);
64
+ } else if (target && typeof target === 'object') {
65
+ if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
66
+ target[source] = true;
67
+ }
68
+ } else {
69
+ return [target, source];
70
+ }
71
+
72
+ return target;
73
+ }
74
+
75
+ if (!target || typeof target !== 'object') {
76
+ return [target].concat(source);
77
+ }
78
+
79
+ let mergeTarget = target;
80
+ if (isArray(target) && !isArray(source)) {
81
+ // @ts-ignore
82
+ mergeTarget = array_to_object(target, options);
83
+ }
84
+
85
+ if (isArray(target) && isArray(source)) {
86
+ source.forEach(function (item, i) {
87
+ if (has(target, i)) {
88
+ const targetItem = target[i];
89
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
+ target[i] = merge(targetItem, item, options);
91
+ } else {
92
+ target.push(item);
93
+ }
94
+ } else {
95
+ target[i] = item;
96
+ }
97
+ });
98
+ return target;
99
+ }
100
+
101
+ return Object.keys(source).reduce(function (acc, key) {
102
+ const value = source[key];
103
+
104
+ if (has(acc, key)) {
105
+ acc[key] = merge(acc[key], value, options);
106
+ } else {
107
+ acc[key] = value;
108
+ }
109
+ return acc;
110
+ }, mergeTarget);
111
+ }
112
+
113
+ export function assign_single_source(target: any, source: any) {
114
+ return Object.keys(source).reduce(function (acc, key) {
115
+ acc[key] = source[key];
116
+ return acc;
117
+ }, target);
118
+ }
119
+
120
+ export function decode(str: string, _: any, charset: string) {
121
+ const strWithoutPlus = str.replace(/\+/g, ' ');
122
+ if (charset === 'iso-8859-1') {
123
+ // unescape never throws, no try...catch needed:
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
125
+ }
126
+ // utf-8
127
+ try {
128
+ return decodeURIComponent(strWithoutPlus);
129
+ } catch (e) {
130
+ return strWithoutPlus;
131
+ }
132
+ }
133
+
134
+ const limit = 1024;
135
+
136
+ export const encode: (
137
+ str: any,
138
+ defaultEncoder: DefaultEncoder,
139
+ charset: string,
140
+ type: 'key' | 'value',
141
+ format: Format,
142
+ ) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
143
+ // This code was originally written by Brian White for the io.js core querystring library.
144
+ // It has been adapted here for stricter adherence to RFC 3986
145
+ if (str.length === 0) {
146
+ return str;
147
+ }
148
+
149
+ let string = str;
150
+ if (typeof str === 'symbol') {
151
+ string = Symbol.prototype.toString.call(str);
152
+ } else if (typeof str !== 'string') {
153
+ string = String(str);
154
+ }
155
+
156
+ if (charset === 'iso-8859-1') {
157
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
+ });
160
+ }
161
+
162
+ let out = '';
163
+ for (let j = 0; j < string.length; j += limit) {
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string;
165
+ const arr = [];
166
+
167
+ for (let i = 0; i < segment.length; ++i) {
168
+ let c = segment.charCodeAt(i);
169
+ if (
170
+ c === 0x2d || // -
171
+ c === 0x2e || // .
172
+ c === 0x5f || // _
173
+ c === 0x7e || // ~
174
+ (c >= 0x30 && c <= 0x39) || // 0-9
175
+ (c >= 0x41 && c <= 0x5a) || // a-z
176
+ (c >= 0x61 && c <= 0x7a) || // A-Z
177
+ (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
+ ) {
179
+ arr[arr.length] = segment.charAt(i);
180
+ continue;
181
+ }
182
+
183
+ if (c < 0x80) {
184
+ arr[arr.length] = hex_table[c];
185
+ continue;
186
+ }
187
+
188
+ if (c < 0x800) {
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
+ continue;
191
+ }
192
+
193
+ if (c < 0xd800 || c >= 0xe000) {
194
+ arr[arr.length] =
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
+ continue;
197
+ }
198
+
199
+ i += 1;
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
201
+
202
+ arr[arr.length] =
203
+ hex_table[0xf0 | (c >> 18)]! +
204
+ hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
+ hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
+ hex_table[0x80 | (c & 0x3f)];
207
+ }
208
+
209
+ out += arr.join('');
210
+ }
211
+
212
+ return out;
213
+ };
214
+
215
+ export function compact(value: any) {
216
+ const queue = [{ obj: { o: value }, prop: 'o' }];
217
+ const refs = [];
218
+
219
+ for (let i = 0; i < queue.length; ++i) {
220
+ const item = queue[i];
221
+ // @ts-ignore
222
+ const obj = item.obj[item.prop];
223
+
224
+ const keys = Object.keys(obj);
225
+ for (let j = 0; j < keys.length; ++j) {
226
+ const key = keys[j]!;
227
+ const val = obj[key];
228
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
+ queue.push({ obj: obj, prop: key });
230
+ refs.push(val);
231
+ }
232
+ }
233
+ }
234
+
235
+ compact_queue(queue);
236
+
237
+ return value;
238
+ }
239
+
240
+ export function is_regexp(obj: any) {
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
242
+ }
243
+
244
+ export function is_buffer(obj: any) {
245
+ if (!obj || typeof obj !== 'object') {
246
+ return false;
247
+ }
248
+
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
250
+ }
251
+
252
+ export function combine(a: any, b: any) {
253
+ return [].concat(a, b);
254
+ }
255
+
256
+ export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
+ if (isArray(val)) {
258
+ const mapped = [];
259
+ for (let i = 0; i < val.length; i += 1) {
260
+ mapped.push(fn(val[i]!));
261
+ }
262
+ return mapped;
263
+ }
264
+ return fn(val);
265
+ }
@@ -1,9 +1,3 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export {
4
- V1,
5
- type V1CreateEventResponse,
6
- type V1CreateUsageResponse,
7
- type V1CreateEventParams,
8
- type V1CreateUsageParams,
9
- } from './v1/v1';
3
+ export { V1 } from './v1/v1';
@@ -8,21 +8,22 @@ import { path } from '../../internal/utils/path';
8
8
 
9
9
  export class Coupons extends APIResource {
10
10
  /**
11
- * Create coupon
11
+ * Creates a new discount coupon with percentage or fixed amount off, applicable to
12
+ * customer subscriptions.
12
13
  */
13
- create(body: CouponCreateParams, options?: RequestOptions): APIPromise<CouponCreateResponse> {
14
+ create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon> {
14
15
  return this._client.post('/api/v1/coupons', { body, ...options });
15
16
  }
16
17
 
17
18
  /**
18
- * Get a single coupon by ID
19
+ * Retrieves a coupon by its unique identifier.
19
20
  */
20
- retrieve(id: string, options?: RequestOptions): APIPromise<CouponRetrieveResponse> {
21
+ retrieve(id: string, options?: RequestOptions): APIPromise<Coupon> {
21
22
  return this._client.get(path`/api/v1/coupons/${id}`, options);
22
23
  }
23
24
 
24
25
  /**
25
- * Get a list of coupons
26
+ * Retrieves a paginated list of coupons in the environment.
26
27
  */
27
28
  list(
28
29
  query: CouponListParams | null | undefined = {},
@@ -40,229 +41,14 @@ export type CouponListResponsesMyCursorIDPage = MyCursorIDPage<CouponListRespons
40
41
  /**
41
42
  * Response object
42
43
  */
43
- export interface CouponCreateResponse {
44
+ export interface Coupon {
44
45
  /**
45
46
  * Discount instrument with percentage or fixed amount
46
47
  */
47
- data: CouponCreateResponse.Data;
48
+ data: Coupon.Data;
48
49
  }
49
50
 
50
- export namespace CouponCreateResponse {
51
- /**
52
- * Discount instrument with percentage or fixed amount
53
- */
54
- export interface Data {
55
- /**
56
- * The unique identifier for the entity
57
- */
58
- id: string;
59
-
60
- /**
61
- * Fixed amount discounts in different currencies
62
- */
63
- amountsOff: Array<Data.AmountsOff> | null;
64
-
65
- /**
66
- * The unique identifier for the entity in the billing provider
67
- */
68
- billingId: string | null;
69
-
70
- /**
71
- * The URL to the entity in the billing provider
72
- */
73
- billingLinkUrl: string | null;
74
-
75
- /**
76
- * Timestamp of when the record was created
77
- */
78
- createdAt: string;
79
-
80
- /**
81
- * Description of the coupon
82
- */
83
- description: string | null;
84
-
85
- /**
86
- * Duration of the coupon validity in months
87
- */
88
- durationInMonths: number | null;
89
-
90
- /**
91
- * Name of the coupon
92
- */
93
- name: string;
94
-
95
- /**
96
- * Percentage discount off the original price
97
- */
98
- percentOff: number | null;
99
-
100
- /**
101
- * The source of the coupon
102
- */
103
- source: 'STIGG' | 'STIGG_ADHOC' | 'STRIPE' | null;
104
-
105
- /**
106
- * Current status of the coupon
107
- */
108
- status: 'ACTIVE' | 'ARCHIVED';
109
-
110
- /**
111
- * Type of the coupon (percentage or fixed amount)
112
- */
113
- type: 'FIXED' | 'PERCENTAGE';
114
-
115
- /**
116
- * Timestamp of when the record was last updated
117
- */
118
- updatedAt: string;
119
- }
120
-
121
- export namespace Data {
122
- /**
123
- * Monetary amount with currency
124
- */
125
- export interface AmountsOff {
126
- /**
127
- * The price amount
128
- */
129
- amount: number;
130
-
131
- /**
132
- * The price currency
133
- */
134
- currency:
135
- | 'usd'
136
- | 'aed'
137
- | 'all'
138
- | 'amd'
139
- | 'ang'
140
- | 'aud'
141
- | 'awg'
142
- | 'azn'
143
- | 'bam'
144
- | 'bbd'
145
- | 'bdt'
146
- | 'bgn'
147
- | 'bif'
148
- | 'bmd'
149
- | 'bnd'
150
- | 'bsd'
151
- | 'bwp'
152
- | 'byn'
153
- | 'bzd'
154
- | 'brl'
155
- | 'cad'
156
- | 'cdf'
157
- | 'chf'
158
- | 'cny'
159
- | 'czk'
160
- | 'dkk'
161
- | 'dop'
162
- | 'dzd'
163
- | 'egp'
164
- | 'etb'
165
- | 'eur'
166
- | 'fjd'
167
- | 'gbp'
168
- | 'gel'
169
- | 'gip'
170
- | 'gmd'
171
- | 'gyd'
172
- | 'hkd'
173
- | 'hrk'
174
- | 'htg'
175
- | 'idr'
176
- | 'ils'
177
- | 'inr'
178
- | 'isk'
179
- | 'jmd'
180
- | 'jpy'
181
- | 'kes'
182
- | 'kgs'
183
- | 'khr'
184
- | 'kmf'
185
- | 'krw'
186
- | 'kyd'
187
- | 'kzt'
188
- | 'lbp'
189
- | 'lkr'
190
- | 'lrd'
191
- | 'lsl'
192
- | 'mad'
193
- | 'mdl'
194
- | 'mga'
195
- | 'mkd'
196
- | 'mmk'
197
- | 'mnt'
198
- | 'mop'
199
- | 'mro'
200
- | 'mvr'
201
- | 'mwk'
202
- | 'mxn'
203
- | 'myr'
204
- | 'mzn'
205
- | 'nad'
206
- | 'ngn'
207
- | 'nok'
208
- | 'npr'
209
- | 'nzd'
210
- | 'pgk'
211
- | 'php'
212
- | 'pkr'
213
- | 'pln'
214
- | 'qar'
215
- | 'ron'
216
- | 'rsd'
217
- | 'rub'
218
- | 'rwf'
219
- | 'sar'
220
- | 'sbd'
221
- | 'scr'
222
- | 'sek'
223
- | 'sgd'
224
- | 'sle'
225
- | 'sll'
226
- | 'sos'
227
- | 'szl'
228
- | 'thb'
229
- | 'tjs'
230
- | 'top'
231
- | 'try'
232
- | 'ttd'
233
- | 'tzs'
234
- | 'uah'
235
- | 'uzs'
236
- | 'vnd'
237
- | 'vuv'
238
- | 'wst'
239
- | 'xaf'
240
- | 'xcd'
241
- | 'yer'
242
- | 'zar'
243
- | 'zmw'
244
- | 'clp'
245
- | 'djf'
246
- | 'gnf'
247
- | 'ugx'
248
- | 'pyg'
249
- | 'xof'
250
- | 'xpf';
251
- }
252
- }
253
- }
254
-
255
- /**
256
- * Response object
257
- */
258
- export interface CouponRetrieveResponse {
259
- /**
260
- * Discount instrument with percentage or fixed amount
261
- */
262
- data: CouponRetrieveResponse.Data;
263
- }
264
-
265
- export namespace CouponRetrieveResponse {
51
+ export namespace Coupon {
266
52
  /**
267
53
  * Discount instrument with percentage or fixed amount
268
54
  */
@@ -691,6 +477,11 @@ export interface CouponCreateParams {
691
477
  */
692
478
  durationInMonths: number | null;
693
479
 
480
+ /**
481
+ * Metadata associated with the entity
482
+ */
483
+ metadata: { [key: string]: string } | null;
484
+
694
485
  /**
695
486
  * Name of the coupon
696
487
  */
@@ -700,11 +491,6 @@ export interface CouponCreateParams {
700
491
  * Percentage discount off the original price
701
492
  */
702
493
  percentOff: number | null;
703
-
704
- /**
705
- * Metadata associated with the entity
706
- */
707
- additionalMetaData?: unknown;
708
494
  }
709
495
 
710
496
  export namespace CouponCreateParams {
@@ -840,12 +626,58 @@ export namespace CouponCreateParams {
840
626
  }
841
627
  }
842
628
 
843
- export interface CouponListParams extends MyCursorIDPageParams {}
629
+ export interface CouponListParams extends MyCursorIDPageParams {
630
+ /**
631
+ * Filter by entity ID
632
+ */
633
+ id?: string;
634
+
635
+ /**
636
+ * Filter by creation date using range operators: gt, gte, lt, lte
637
+ */
638
+ createdAt?: CouponListParams.CreatedAt;
639
+
640
+ /**
641
+ * Filter by coupon status. Supports comma-separated values for multiple statuses
642
+ */
643
+ status?: string;
644
+
645
+ /**
646
+ * Filter by coupon type (FIXED or PERCENTAGE)
647
+ */
648
+ type?: 'FIXED' | 'PERCENTAGE';
649
+ }
650
+
651
+ export namespace CouponListParams {
652
+ /**
653
+ * Filter by creation date using range operators: gt, gte, lt, lte
654
+ */
655
+ export interface CreatedAt {
656
+ /**
657
+ * Greater than the specified createdAt value
658
+ */
659
+ gt?: string;
660
+
661
+ /**
662
+ * Greater than or equal to the specified createdAt value
663
+ */
664
+ gte?: string;
665
+
666
+ /**
667
+ * Less than the specified createdAt value
668
+ */
669
+ lt?: string;
670
+
671
+ /**
672
+ * Less than or equal to the specified createdAt value
673
+ */
674
+ lte?: string;
675
+ }
676
+ }
844
677
 
845
678
  export declare namespace Coupons {
846
679
  export {
847
- type CouponCreateResponse as CouponCreateResponse,
848
- type CouponRetrieveResponse as CouponRetrieveResponse,
680
+ type Coupon as Coupon,
849
681
  type CouponListResponse as CouponListResponse,
850
682
  type CouponListResponsesMyCursorIDPage as CouponListResponsesMyCursorIDPage,
851
683
  type CouponCreateParams as CouponCreateParams,