@polar-sh/sdk 0.20.0 → 0.20.1

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 (115) hide show
  1. package/README.md +4 -0
  2. package/docs/sdks/polarsubscriptions/README.md +6 -5
  3. package/docs/sdks/subscriptions/README.md +165 -1
  4. package/funcs/customerPortalSubscriptionsUpdate.d.ts +1 -1
  5. package/funcs/customerPortalSubscriptionsUpdate.d.ts.map +1 -1
  6. package/funcs/customerPortalSubscriptionsUpdate.js +2 -2
  7. package/funcs/customerPortalSubscriptionsUpdate.js.map +1 -1
  8. package/funcs/subscriptionsRevoke.d.ts +17 -0
  9. package/funcs/subscriptionsRevoke.d.ts.map +1 -0
  10. package/funcs/subscriptionsRevoke.js +106 -0
  11. package/funcs/subscriptionsRevoke.js.map +1 -0
  12. package/funcs/subscriptionsUpdate.d.ts +17 -0
  13. package/funcs/subscriptionsUpdate.d.ts.map +1 -0
  14. package/funcs/subscriptionsUpdate.js +109 -0
  15. package/funcs/subscriptionsUpdate.js.map +1 -0
  16. package/lib/config.d.ts +3 -3
  17. package/lib/config.js +3 -3
  18. package/models/components/customercancellationreason.d.ts +46 -0
  19. package/models/components/customercancellationreason.d.ts.map +1 -0
  20. package/models/components/customercancellationreason.js +56 -0
  21. package/models/components/customercancellationreason.js.map +1 -0
  22. package/models/components/customerordersubscription.d.ts +9 -0
  23. package/models/components/customerordersubscription.d.ts.map +1 -1
  24. package/models/components/customerordersubscription.js +17 -0
  25. package/models/components/customerordersubscription.js.map +1 -1
  26. package/models/components/customersubscription.d.ts +9 -0
  27. package/models/components/customersubscription.d.ts.map +1 -1
  28. package/models/components/customersubscription.js +17 -0
  29. package/models/components/customersubscription.js.map +1 -1
  30. package/models/components/customersubscriptioncancel.d.ts +58 -0
  31. package/models/components/customersubscriptioncancel.d.ts.map +1 -0
  32. package/models/components/customersubscriptioncancel.js +79 -0
  33. package/models/components/customersubscriptioncancel.js.map +1 -0
  34. package/models/components/customersubscriptionupdate.d.ts +4 -6
  35. package/models/components/customersubscriptionupdate.d.ts.map +1 -1
  36. package/models/components/customersubscriptionupdate.js +10 -15
  37. package/models/components/customersubscriptionupdate.js.map +1 -1
  38. package/models/components/customersubscriptionupdateprice.d.ts +32 -0
  39. package/models/components/customersubscriptionupdateprice.d.ts.map +1 -0
  40. package/models/components/customersubscriptionupdateprice.js +68 -0
  41. package/models/components/customersubscriptionupdateprice.js.map +1 -0
  42. package/models/components/index.d.ts +7 -0
  43. package/models/components/index.d.ts.map +1 -1
  44. package/models/components/index.js +7 -0
  45. package/models/components/index.js.map +1 -1
  46. package/models/components/ordersubscription.d.ts +9 -0
  47. package/models/components/ordersubscription.d.ts.map +1 -1
  48. package/models/components/ordersubscription.js +17 -0
  49. package/models/components/ordersubscription.js.map +1 -1
  50. package/models/components/subscription.d.ts +9 -0
  51. package/models/components/subscription.d.ts.map +1 -1
  52. package/models/components/subscription.js +17 -0
  53. package/models/components/subscription.js.map +1 -1
  54. package/models/components/subscriptioncancel.d.ts +80 -0
  55. package/models/components/subscriptioncancel.d.ts.map +1 -0
  56. package/models/components/subscriptioncancel.js +79 -0
  57. package/models/components/subscriptioncancel.js.map +1 -0
  58. package/models/components/subscriptionupdate.d.ts +27 -0
  59. package/models/components/subscriptionupdate.d.ts.map +1 -0
  60. package/models/components/subscriptionupdate.js +63 -0
  61. package/models/components/subscriptionupdate.js.map +1 -0
  62. package/models/components/subscriptionupdateprice.d.ts +32 -0
  63. package/models/components/subscriptionupdateprice.d.ts.map +1 -0
  64. package/models/components/subscriptionupdateprice.js +68 -0
  65. package/models/components/subscriptionupdateprice.js.map +1 -0
  66. package/models/components/webhooksubscriptioncanceledpayload.d.ts +2 -2
  67. package/models/components/webhooksubscriptionuncanceledpayload.d.ts +39 -0
  68. package/models/components/webhooksubscriptionuncanceledpayload.d.ts.map +1 -0
  69. package/models/components/webhooksubscriptionuncanceledpayload.js +62 -0
  70. package/models/components/webhooksubscriptionuncanceledpayload.js.map +1 -0
  71. package/models/operations/customerportalsubscriptionscancel.d.ts +1 -1
  72. package/models/operations/customerportalsubscriptionsget.d.ts +1 -1
  73. package/models/operations/customerportalsubscriptionsupdate.d.ts +1 -1
  74. package/models/operations/index.d.ts +2 -0
  75. package/models/operations/index.d.ts.map +1 -1
  76. package/models/operations/index.js +2 -0
  77. package/models/operations/index.js.map +1 -1
  78. package/models/operations/subscriptionsrevoke.d.ts +32 -0
  79. package/models/operations/subscriptionsrevoke.d.ts.map +1 -0
  80. package/models/operations/subscriptionsrevoke.js +59 -0
  81. package/models/operations/subscriptionsrevoke.js.map +1 -0
  82. package/models/operations/subscriptionsupdate.d.ts +35 -0
  83. package/models/operations/subscriptionsupdate.d.ts.map +1 -0
  84. package/models/operations/subscriptionsupdate.js +71 -0
  85. package/models/operations/subscriptionsupdate.js.map +1 -0
  86. package/package.json +1 -1
  87. package/sdk/subscriptions.d.ts +15 -0
  88. package/sdk/subscriptions.d.ts.map +1 -1
  89. package/sdk/subscriptions.js +20 -0
  90. package/sdk/subscriptions.js.map +1 -1
  91. package/src/funcs/customerPortalSubscriptionsUpdate.ts +4 -1
  92. package/src/funcs/subscriptionsRevoke.ts +146 -0
  93. package/src/funcs/subscriptionsUpdate.ts +149 -0
  94. package/src/lib/config.ts +3 -3
  95. package/src/models/components/customercancellationreason.ts +41 -0
  96. package/src/models/components/customerordersubscription.ts +37 -0
  97. package/src/models/components/customersubscription.ts +37 -0
  98. package/src/models/components/customersubscriptioncancel.ts +118 -0
  99. package/src/models/components/customersubscriptionupdate.ts +26 -21
  100. package/src/models/components/customersubscriptionupdateprice.ts +80 -0
  101. package/src/models/components/index.ts +7 -0
  102. package/src/models/components/ordersubscription.ts +37 -0
  103. package/src/models/components/subscription.ts +37 -0
  104. package/src/models/components/subscriptioncancel.ts +144 -0
  105. package/src/models/components/subscriptionupdate.ts +78 -0
  106. package/src/models/components/subscriptionupdateprice.ts +78 -0
  107. package/src/models/components/webhooksubscriptioncanceledpayload.ts +2 -2
  108. package/src/models/components/webhooksubscriptionuncanceledpayload.ts +90 -0
  109. package/src/models/operations/customerportalsubscriptionscancel.ts +1 -1
  110. package/src/models/operations/customerportalsubscriptionsget.ts +1 -1
  111. package/src/models/operations/customerportalsubscriptionsupdate.ts +1 -1
  112. package/src/models/operations/index.ts +2 -0
  113. package/src/models/operations/subscriptionsrevoke.ts +69 -0
  114. package/src/models/operations/subscriptionsupdate.ts +83 -0
  115. package/src/sdk/subscriptions.ts +37 -0
package/README.md CHANGED
@@ -496,6 +496,8 @@ app.post("/webhook", express.raw({ type: "application/json" }), (req: Request, r
496
496
 
497
497
  * [list](docs/sdks/subscriptions/README.md#list) - List Subscriptions
498
498
  * [export](docs/sdks/subscriptions/README.md#export) - Export Subscriptions
499
+ * [update](docs/sdks/subscriptions/README.md#update) - Update Subscription
500
+ * [revoke](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription
499
501
 
500
502
  </details>
501
503
  <!-- End Available Resources and Operations [operations] -->
@@ -609,6 +611,8 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
609
611
  - [`repositoriesUpdate`](docs/sdks/repositories/README.md#update) - Update Repository
610
612
  - [`subscriptionsExport`](docs/sdks/subscriptions/README.md#export) - Export Subscriptions
611
613
  - [`subscriptionsList`](docs/sdks/subscriptions/README.md#list) - List Subscriptions
614
+ - [`subscriptionsRevoke`](docs/sdks/subscriptions/README.md#revoke) - Revoke Subscription
615
+ - [`subscriptionsUpdate`](docs/sdks/subscriptions/README.md#update) - Update Subscription
612
616
  - ~~[`checkoutsCreate`](docs/sdks/checkouts/README.md#create)~~ - Create Checkout :warning: **Deprecated** Use [`checkoutsCustomCreate`](docs/sdks/custom/README.md#create) instead.
613
617
  - ~~[`checkoutsGet`](docs/sdks/checkouts/README.md#get)~~ - Get Checkout :warning: **Deprecated**
614
618
 
@@ -243,11 +243,12 @@ run();
243
243
 
244
244
  ### Errors
245
245
 
246
- | Error Type | Status Code | Content Type |
247
- | -------------------------- | -------------------------- | -------------------------- |
248
- | errors.ResourceNotFound | 404 | application/json |
249
- | errors.HTTPValidationError | 422 | application/json |
250
- | errors.SDKError | 4XX, 5XX | \*/\* |
246
+ | Error Type | Status Code | Content Type |
247
+ | ---------------------------------- | ---------------------------------- | ---------------------------------- |
248
+ | errors.AlreadyCanceledSubscription | 403 | application/json |
249
+ | errors.ResourceNotFound | 404 | application/json |
250
+ | errors.HTTPValidationError | 422 | application/json |
251
+ | errors.SDKError | 4XX, 5XX | \*/\* |
251
252
 
252
253
  ## cancel
253
254
 
@@ -7,6 +7,8 @@
7
7
 
8
8
  * [list](#list) - List Subscriptions
9
9
  * [export](#export) - Export Subscriptions
10
+ * [update](#update) - Update Subscription
11
+ * [revoke](#revoke) - Revoke Subscription
10
12
 
11
13
  ## list
12
14
 
@@ -156,4 +158,166 @@ run();
156
158
  | Error Type | Status Code | Content Type |
157
159
  | -------------------------- | -------------------------- | -------------------------- |
158
160
  | errors.HTTPValidationError | 422 | application/json |
159
- | errors.SDKError | 4XX, 5XX | \*/\* |
161
+ | errors.SDKError | 4XX, 5XX | \*/\* |
162
+
163
+ ## update
164
+
165
+ Update a subscription.
166
+
167
+ ### Example Usage
168
+
169
+ ```typescript
170
+ import { Polar } from "@polar-sh/sdk";
171
+
172
+ const polar = new Polar({
173
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
174
+ });
175
+
176
+ async function run() {
177
+ const result = await polar.subscriptions.update({
178
+ id: "<value>",
179
+ subscriptionUpdate: {},
180
+ });
181
+
182
+ // Handle the result
183
+ console.log(result);
184
+ }
185
+
186
+ run();
187
+ ```
188
+
189
+ ### Standalone function
190
+
191
+ The standalone function version of this method:
192
+
193
+ ```typescript
194
+ import { PolarCore } from "@polar-sh/sdk/core.js";
195
+ import { subscriptionsUpdate } from "@polar-sh/sdk/funcs/subscriptionsUpdate.js";
196
+
197
+ // Use `PolarCore` for best tree-shaking performance.
198
+ // You can create one instance of it to use across an application.
199
+ const polar = new PolarCore({
200
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
201
+ });
202
+
203
+ async function run() {
204
+ const res = await subscriptionsUpdate(polar, {
205
+ id: "<value>",
206
+ subscriptionUpdate: {
207
+ productPriceId: "<value>",
208
+ },
209
+ });
210
+
211
+ if (!res.ok) {
212
+ throw res.error;
213
+ }
214
+
215
+ const { value: result } = res;
216
+
217
+ // Handle the result
218
+ console.log(result);
219
+ }
220
+
221
+ run();
222
+ ```
223
+
224
+ ### Parameters
225
+
226
+ | Parameter | Type | Required | Description |
227
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
228
+ | `request` | [operations.SubscriptionsUpdateRequest](../../models/operations/subscriptionsupdaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
229
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
230
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
231
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
232
+
233
+ ### Response
234
+
235
+ **Promise\<[components.Subscription](../../models/components/subscription.md)\>**
236
+
237
+ ### Errors
238
+
239
+ | Error Type | Status Code | Content Type |
240
+ | ---------------------------------- | ---------------------------------- | ---------------------------------- |
241
+ | errors.AlreadyCanceledSubscription | 403 | application/json |
242
+ | errors.ResourceNotFound | 404 | application/json |
243
+ | errors.HTTPValidationError | 422 | application/json |
244
+ | errors.SDKError | 4XX, 5XX | \*/\* |
245
+
246
+ ## revoke
247
+
248
+ Revoke a subscription, i.e cancel immediately.
249
+
250
+ ### Example Usage
251
+
252
+ ```typescript
253
+ import { Polar } from "@polar-sh/sdk";
254
+
255
+ const polar = new Polar({
256
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
257
+ });
258
+
259
+ async function run() {
260
+ const result = await polar.subscriptions.revoke({
261
+ id: "<value>",
262
+ });
263
+
264
+ // Handle the result
265
+ console.log(result);
266
+ }
267
+
268
+ run();
269
+ ```
270
+
271
+ ### Standalone function
272
+
273
+ The standalone function version of this method:
274
+
275
+ ```typescript
276
+ import { PolarCore } from "@polar-sh/sdk/core.js";
277
+ import { subscriptionsRevoke } from "@polar-sh/sdk/funcs/subscriptionsRevoke.js";
278
+
279
+ // Use `PolarCore` for best tree-shaking performance.
280
+ // You can create one instance of it to use across an application.
281
+ const polar = new PolarCore({
282
+ accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
283
+ });
284
+
285
+ async function run() {
286
+ const res = await subscriptionsRevoke(polar, {
287
+ id: "<value>",
288
+ });
289
+
290
+ if (!res.ok) {
291
+ throw res.error;
292
+ }
293
+
294
+ const { value: result } = res;
295
+
296
+ // Handle the result
297
+ console.log(result);
298
+ }
299
+
300
+ run();
301
+ ```
302
+
303
+ ### Parameters
304
+
305
+ | Parameter | Type | Required | Description |
306
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
307
+ | `request` | [operations.SubscriptionsRevokeRequest](../../models/operations/subscriptionsrevokerequest.md) | :heavy_check_mark: | The request object to use for the request. |
308
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
309
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
310
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
311
+
312
+ ### Response
313
+
314
+ **Promise\<[components.Subscription](../../models/components/subscription.md)\>**
315
+
316
+ ### Errors
317
+
318
+ | Error Type | Status Code | Content Type |
319
+ | ---------------------------------- | ---------------------------------- | ---------------------------------- |
320
+ | errors.AlreadyCanceledSubscription | 403 | application/json |
321
+ | errors.ResourceNotFound | 404 | application/json |
322
+ | errors.HTTPValidationError | 422 | application/json |
323
+ | errors.SDKError | 4XX, 5XX | \*/\* |
@@ -13,5 +13,5 @@ import { Result } from "../types/fp.js";
13
13
  * @remarks
14
14
  * Update a subscription of the authenticated customer or user.
15
15
  */
16
- export declare function customerPortalSubscriptionsUpdate(client: PolarCore, request: operations.CustomerPortalSubscriptionsUpdateRequest, options?: RequestOptions): Promise<Result<components.CustomerSubscription, errors.ResourceNotFound | errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
+ export declare function customerPortalSubscriptionsUpdate(client: PolarCore, request: operations.CustomerPortalSubscriptionsUpdateRequest, options?: RequestOptions): Promise<Result<components.CustomerSubscription, errors.AlreadyCanceledSubscription | errors.ResourceNotFound | errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
17
17
  //# sourceMappingURL=customerPortalSubscriptionsUpdate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"customerPortalSubscriptionsUpdate.d.ts","sourceRoot":"","sources":["../src/funcs/customerPortalSubscriptionsUpdate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,wCAAwC,EAC5D,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,oBAAoB,EAC7B,MAAM,CAAC,gBAAgB,GACvB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAmGA"}
1
+ {"version":3,"file":"customerPortalSubscriptionsUpdate.d.ts","sourceRoot":"","sources":["../src/funcs/customerPortalSubscriptionsUpdate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,iCAAiC,CACrD,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,wCAAwC,EAC5D,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,oBAAoB,EAC7B,MAAM,CAAC,2BAA2B,GAClC,MAAM,CAAC,gBAAgB,GACvB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAqGA"}
@@ -89,7 +89,7 @@ async function customerPortalSubscriptionsUpdate(client, request, options) {
89
89
  const req = requestRes.value;
90
90
  const doResult = await client._do(req, {
91
91
  context,
92
- errorCodes: ["404", "422", "4XX", "5XX"],
92
+ errorCodes: ["403", "404", "422", "4XX", "5XX"],
93
93
  retryConfig: context.retryConfig,
94
94
  retryCodes: context.retryCodes,
95
95
  });
@@ -100,7 +100,7 @@ async function customerPortalSubscriptionsUpdate(client, request, options) {
100
100
  const responseFields = {
101
101
  HttpMeta: { Response: response, Request: req },
102
102
  };
103
- const [result] = await M.match(M.json(200, components.CustomerSubscription$inboundSchema), M.jsonErr(404, errors.ResourceNotFound$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail(["4XX", "5XX"]))(response, { extraFields: responseFields });
103
+ const [result] = await M.match(M.json(200, components.CustomerSubscription$inboundSchema), M.jsonErr(403, errors.AlreadyCanceledSubscription$inboundSchema), M.jsonErr(404, errors.ResourceNotFound$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail(["4XX", "5XX"]))(response, { extraFields: responseFields });
104
104
  if (!result.ok) {
105
105
  return result;
106
106
  }
@@ -1 +1 @@
1
- {"version":3,"file":"customerPortalSubscriptionsUpdate.js","sourceRoot":"","sources":["../src/funcs/customerPortalSubsc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CAAC,GAAG,EAAE,MAAM,CAAC,yCAAyC,CAAC,EAChE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,8BAA8B,CAAC,EACrD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,iCAAiC,CAAC,EACxD,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACvB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { PolarCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import * as components from "../models/components/index.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import * as errors from "../models/errors/index.js";
6
+ import { SDKError } from "../models/errors/sdkerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { Result } from "../types/fp.js";
10
+ /**
11
+ * Revoke Subscription
12
+ *
13
+ * @remarks
14
+ * Revoke a subscription, i.e cancel immediately.
15
+ */
16
+ export declare function subscriptionsRevoke(client: PolarCore, request: operations.SubscriptionsRevokeRequest, options?: RequestOptions): Promise<Result<components.Subscription, errors.AlreadyCanceledSubscription | errors.ResourceNotFound | errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
17
+ //# sourceMappingURL=subscriptionsRevoke.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionsRevoke.d.ts","sourceRoot":"","sources":["../src/funcs/subscriptionsRevoke.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,0BAA0B,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,YAAY,EACrB,MAAM,CAAC,2BAA2B,GAClC,MAAM,CAAC,gBAAgB,GACvB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAgGA"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.subscriptionsRevoke = subscriptionsRevoke;
30
+ const encodings_js_1 = require("../lib/encodings.js");
31
+ const M = __importStar(require("../lib/matchers.js"));
32
+ const schemas_js_1 = require("../lib/schemas.js");
33
+ const security_js_1 = require("../lib/security.js");
34
+ const url_js_1 = require("../lib/url.js");
35
+ const components = __importStar(require("../models/components/index.js"));
36
+ const errors = __importStar(require("../models/errors/index.js"));
37
+ const operations = __importStar(require("../models/operations/index.js"));
38
+ /**
39
+ * Revoke Subscription
40
+ *
41
+ * @remarks
42
+ * Revoke a subscription, i.e cancel immediately.
43
+ */
44
+ async function subscriptionsRevoke(client, request, options) {
45
+ const parsed = (0, schemas_js_1.safeParse)(request, (value) => operations.SubscriptionsRevokeRequest$outboundSchema.parse(value), "Input validation failed");
46
+ if (!parsed.ok) {
47
+ return parsed;
48
+ }
49
+ const payload = parsed.value;
50
+ const body = null;
51
+ const pathParams = {
52
+ id: (0, encodings_js_1.encodeSimple)("id", payload.id, {
53
+ explode: false,
54
+ charEncoding: "percent",
55
+ }),
56
+ };
57
+ const path = (0, url_js_1.pathToFunc)("/v1/subscriptions/{id}")(pathParams);
58
+ const headers = new Headers({
59
+ Accept: "application/json",
60
+ });
61
+ const secConfig = await (0, security_js_1.extractSecurity)(client._options.accessToken);
62
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
63
+ const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
64
+ const context = {
65
+ operationID: "subscriptions:revoke",
66
+ oAuth2Scopes: [],
67
+ resolvedSecurity: requestSecurity,
68
+ securitySource: client._options.accessToken,
69
+ retryConfig: options?.retries
70
+ || client._options.retryConfig
71
+ || { strategy: "none" },
72
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
73
+ };
74
+ const requestRes = client._createRequest(context, {
75
+ security: requestSecurity,
76
+ method: "DELETE",
77
+ baseURL: options?.serverURL,
78
+ path: path,
79
+ headers: headers,
80
+ body: body,
81
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
82
+ }, options);
83
+ if (!requestRes.ok) {
84
+ return requestRes;
85
+ }
86
+ const req = requestRes.value;
87
+ const doResult = await client._do(req, {
88
+ context,
89
+ errorCodes: ["403", "404", "422", "4XX", "5XX"],
90
+ retryConfig: context.retryConfig,
91
+ retryCodes: context.retryCodes,
92
+ });
93
+ if (!doResult.ok) {
94
+ return doResult;
95
+ }
96
+ const response = doResult.value;
97
+ const responseFields = {
98
+ HttpMeta: { Response: response, Request: req },
99
+ };
100
+ const [result] = await M.match(M.json(200, components.Subscription$inboundSchema), M.jsonErr(403, errors.AlreadyCanceledSubscription$inboundSchema), M.jsonErr(404, errors.ResourceNotFound$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail(["4XX", "5XX"]))(response, { extraFields: responseFields });
101
+ if (!result.ok) {
102
+ return result;
103
+ }
104
+ return result;
105
+ }
106
+ //# sourceMappingURL=subscriptionsRevoke.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionsRevoke.js","sourceRoot":"","sources":["../src/funcs/subscriptionsRevoke.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AA6BH,kDAkHC;AA5ID,sDAAmD;AACnD,sDAAwC;AACxC,kDAA8C;AAE9C,oDAA4E;AAC5E,0CAA2C;AAC3C,0EAA4D;AAQ5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C,CAAC,KAAK,CAa5B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,0BAA0B,CAAC,EAClD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,yCAAyC,CAAC,EAChE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,8BAA8B,CAAC,EACrD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,iCAAiC,CAAC,EACxD,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACvB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { PolarCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import * as components from "../models/components/index.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import * as errors from "../models/errors/index.js";
6
+ import { SDKError } from "../models/errors/sdkerror.js";
7
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
8
+ import * as operations from "../models/operations/index.js";
9
+ import { Result } from "../types/fp.js";
10
+ /**
11
+ * Update Subscription
12
+ *
13
+ * @remarks
14
+ * Update a subscription.
15
+ */
16
+ export declare function subscriptionsUpdate(client: PolarCore, request: operations.SubscriptionsUpdateRequest, options?: RequestOptions): Promise<Result<components.Subscription, errors.AlreadyCanceledSubscription | errors.ResourceNotFound | errors.HTTPValidationError | SDKError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
17
+ //# sourceMappingURL=subscriptionsUpdate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionsUpdate.d.ts","sourceRoot":"","sources":["../src/funcs/subscriptionsUpdate.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,CAAC,0BAA0B,EAC9C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,YAAY,EACrB,MAAM,CAAC,2BAA2B,GAClC,MAAM,CAAC,gBAAgB,GACvB,MAAM,CAAC,mBAAmB,GAC1B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAmGA"}
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || function (mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
+ __setModuleDefault(result, mod);
26
+ return result;
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.subscriptionsUpdate = subscriptionsUpdate;
30
+ const encodings_js_1 = require("../lib/encodings.js");
31
+ const M = __importStar(require("../lib/matchers.js"));
32
+ const schemas_js_1 = require("../lib/schemas.js");
33
+ const security_js_1 = require("../lib/security.js");
34
+ const url_js_1 = require("../lib/url.js");
35
+ const components = __importStar(require("../models/components/index.js"));
36
+ const errors = __importStar(require("../models/errors/index.js"));
37
+ const operations = __importStar(require("../models/operations/index.js"));
38
+ /**
39
+ * Update Subscription
40
+ *
41
+ * @remarks
42
+ * Update a subscription.
43
+ */
44
+ async function subscriptionsUpdate(client, request, options) {
45
+ const parsed = (0, schemas_js_1.safeParse)(request, (value) => operations.SubscriptionsUpdateRequest$outboundSchema.parse(value), "Input validation failed");
46
+ if (!parsed.ok) {
47
+ return parsed;
48
+ }
49
+ const payload = parsed.value;
50
+ const body = (0, encodings_js_1.encodeJSON)("body", payload.SubscriptionUpdate, {
51
+ explode: true,
52
+ });
53
+ const pathParams = {
54
+ id: (0, encodings_js_1.encodeSimple)("id", payload.id, {
55
+ explode: false,
56
+ charEncoding: "percent",
57
+ }),
58
+ };
59
+ const path = (0, url_js_1.pathToFunc)("/v1/subscriptions/{id}")(pathParams);
60
+ const headers = new Headers({
61
+ "Content-Type": "application/json",
62
+ Accept: "application/json",
63
+ });
64
+ const secConfig = await (0, security_js_1.extractSecurity)(client._options.accessToken);
65
+ const securityInput = secConfig == null ? {} : { accessToken: secConfig };
66
+ const requestSecurity = (0, security_js_1.resolveGlobalSecurity)(securityInput);
67
+ const context = {
68
+ operationID: "subscriptions:update",
69
+ oAuth2Scopes: [],
70
+ resolvedSecurity: requestSecurity,
71
+ securitySource: client._options.accessToken,
72
+ retryConfig: options?.retries
73
+ || client._options.retryConfig
74
+ || { strategy: "none" },
75
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
76
+ };
77
+ const requestRes = client._createRequest(context, {
78
+ security: requestSecurity,
79
+ method: "PATCH",
80
+ baseURL: options?.serverURL,
81
+ path: path,
82
+ headers: headers,
83
+ body: body,
84
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
85
+ }, options);
86
+ if (!requestRes.ok) {
87
+ return requestRes;
88
+ }
89
+ const req = requestRes.value;
90
+ const doResult = await client._do(req, {
91
+ context,
92
+ errorCodes: ["403", "404", "422", "4XX", "5XX"],
93
+ retryConfig: context.retryConfig,
94
+ retryCodes: context.retryCodes,
95
+ });
96
+ if (!doResult.ok) {
97
+ return doResult;
98
+ }
99
+ const response = doResult.value;
100
+ const responseFields = {
101
+ HttpMeta: { Response: response, Request: req },
102
+ };
103
+ const [result] = await M.match(M.json(200, components.Subscription$inboundSchema), M.jsonErr(403, errors.AlreadyCanceledSubscription$inboundSchema), M.jsonErr(404, errors.ResourceNotFound$inboundSchema), M.jsonErr(422, errors.HTTPValidationError$inboundSchema), M.fail(["4XX", "5XX"]))(response, { extraFields: responseFields });
104
+ if (!result.ok) {
105
+ return result;
106
+ }
107
+ return result;
108
+ }
109
+ //# sourceMappingURL=subscriptionsUpdate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionsUpdate.js","sourceRoot":"","sources":["../src/funcs/subscriptionsUpdate.ts"],"names":[],"mappings":";AA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,EAAE,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEhC,MAAM,cAAc,GAAG;QACrB,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE;KAC/C,CAAC;IAEF,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,CAAC,KAAK,CAa5B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,0BAA0B,CAAC,EAClD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,yCAAyC,CAAC,EAChE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,8BAA8B,CAAC,EACrD,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,iCAAiC,CAAC,EACxD,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CACvB,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/lib/config.d.ts CHANGED
@@ -38,8 +38,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
38
38
  export declare const SDK_METADATA: {
39
39
  readonly language: "typescript";
40
40
  readonly openapiDocVersion: "0.1.0";
41
- readonly sdkVersion: "0.20.0";
42
- readonly genVersion: "2.484.0";
43
- readonly userAgent: "speakeasy-sdk/typescript 0.20.0 2.484.0 0.1.0 @polar-sh/sdk";
41
+ readonly sdkVersion: "0.20.1";
42
+ readonly genVersion: "2.486.1";
43
+ readonly userAgent: "speakeasy-sdk/typescript 0.20.1 2.486.1 0.1.0 @polar-sh/sdk";
44
44
  };
45
45
  //# sourceMappingURL=config.d.ts.map
package/lib/config.js CHANGED
@@ -34,8 +34,8 @@ function serverURLFromOptions(options) {
34
34
  exports.SDK_METADATA = {
35
35
  language: "typescript",
36
36
  openapiDocVersion: "0.1.0",
37
- sdkVersion: "0.20.0",
38
- genVersion: "2.484.0",
39
- userAgent: "speakeasy-sdk/typescript 0.20.0 2.484.0 0.1.0 @polar-sh/sdk",
37
+ sdkVersion: "0.20.1",
38
+ genVersion: "2.486.1",
39
+ userAgent: "speakeasy-sdk/typescript 0.20.1 2.486.1 0.1.0 @polar-sh/sdk",
40
40
  };
41
41
  //# sourceMappingURL=config.js.map
@@ -0,0 +1,46 @@
1
+ import * as z from "zod";
2
+ import { ClosedEnum } from "../../types/enums.js";
3
+ export declare const CustomerCancellationReason: {
4
+ readonly CustomerService: "customer_service";
5
+ readonly LowQuality: "low_quality";
6
+ readonly MissingFeatures: "missing_features";
7
+ readonly SwitchedService: "switched_service";
8
+ readonly TooComplex: "too_complex";
9
+ readonly TooExpensive: "too_expensive";
10
+ readonly Unused: "unused";
11
+ readonly Other: "other";
12
+ };
13
+ export type CustomerCancellationReason = ClosedEnum<typeof CustomerCancellationReason>;
14
+ /** @internal */
15
+ export declare const CustomerCancellationReason$inboundSchema: z.ZodNativeEnum<typeof CustomerCancellationReason>;
16
+ /** @internal */
17
+ export declare const CustomerCancellationReason$outboundSchema: z.ZodNativeEnum<typeof CustomerCancellationReason>;
18
+ /**
19
+ * @internal
20
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
21
+ */
22
+ export declare namespace CustomerCancellationReason$ {
23
+ /** @deprecated use `CustomerCancellationReason$inboundSchema` instead. */
24
+ const inboundSchema: z.ZodNativeEnum<{
25
+ readonly CustomerService: "customer_service";
26
+ readonly LowQuality: "low_quality";
27
+ readonly MissingFeatures: "missing_features";
28
+ readonly SwitchedService: "switched_service";
29
+ readonly TooComplex: "too_complex";
30
+ readonly TooExpensive: "too_expensive";
31
+ readonly Unused: "unused";
32
+ readonly Other: "other";
33
+ }>;
34
+ /** @deprecated use `CustomerCancellationReason$outboundSchema` instead. */
35
+ const outboundSchema: z.ZodNativeEnum<{
36
+ readonly CustomerService: "customer_service";
37
+ readonly LowQuality: "low_quality";
38
+ readonly MissingFeatures: "missing_features";
39
+ readonly SwitchedService: "switched_service";
40
+ readonly TooComplex: "too_complex";
41
+ readonly TooExpensive: "too_expensive";
42
+ readonly Unused: "unused";
43
+ readonly Other: "other";
44
+ }>;
45
+ }
46
+ //# sourceMappingURL=customercancellationreason.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"customercancellationreason.d.ts","sourceRoot":"","sources":["../../src/models/components/customercancellationreason.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,0BAA0B;;;;;;;;;CAS7B,CAAC;AACX,MAAM,MAAM,0BAA0B,GAAG,UAAU,CACjD,OAAO,0BAA0B,CAClC,CAAC;AAEF,gBAAgB;AAChB,eAAO,MAAM,wCAAwC,EAAE,CAAC,CAAC,aAAa,CACpE,OAAO,0BAA0B,CACS,CAAC;AAE7C,gBAAgB;AAChB,eAAO,MAAM,yCAAyC,EAAE,CAAC,CAAC,aAAa,CACrE,OAAO,0BAA0B,CACS,CAAC;AAE7C;;;GAGG;AACH,yBAAiB,2BAA2B,CAAC;IAC3C,0EAA0E;IACnE,MAAM,aAAa;;;;;;;;;MAA2C,CAAC;IACtE,2EAA2E;IACpE,MAAM,cAAc;;;;;;;;;MAA4C,CAAC;CACzE"}