@polar-sh/sdk 0.13.0 → 0.13.2
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.
- package/README.md +15 -0
- package/docs/sdks/articles/README.md +78 -0
- package/docs/sdks/benefits/README.md +3 -3
- package/docs/sdks/checkoutlinks/README.md +400 -0
- package/funcs/articlesExport.d.ts +16 -0
- package/funcs/articlesExport.d.ts.map +1 -0
- package/funcs/articlesExport.js +99 -0
- package/funcs/articlesExport.js.map +1 -0
- package/funcs/benefitsCreate.d.ts +2 -1
- package/funcs/benefitsCreate.d.ts.map +1 -1
- package/funcs/benefitsCreate.js +2 -1
- package/funcs/benefitsCreate.js.map +1 -1
- package/funcs/benefitsGet.d.ts +2 -1
- package/funcs/benefitsGet.d.ts.map +1 -1
- package/funcs/benefitsGet.js +2 -1
- package/funcs/benefitsGet.js.map +1 -1
- package/funcs/benefitsUpdate.d.ts +2 -1
- package/funcs/benefitsUpdate.d.ts.map +1 -1
- package/funcs/benefitsUpdate.js +2 -1
- package/funcs/benefitsUpdate.js.map +1 -1
- package/funcs/checkoutLinksCreate.d.ts +16 -0
- package/funcs/checkoutLinksCreate.d.ts.map +1 -0
- package/funcs/checkoutLinksCreate.js +95 -0
- package/funcs/checkoutLinksCreate.js.map +1 -0
- package/funcs/checkoutLinksDelete.d.ts +16 -0
- package/funcs/checkoutLinksDelete.d.ts.map +1 -0
- package/funcs/checkoutLinksDelete.js +101 -0
- package/funcs/checkoutLinksDelete.js.map +1 -0
- package/funcs/checkoutLinksGet.d.ts +17 -0
- package/funcs/checkoutLinksGet.d.ts.map +1 -0
- package/funcs/checkoutLinksGet.js +101 -0
- package/funcs/checkoutLinksGet.js.map +1 -0
- package/funcs/checkoutLinksList.d.ts +17 -0
- package/funcs/checkoutLinksList.d.ts.map +1 -0
- package/funcs/checkoutLinksList.js +130 -0
- package/funcs/checkoutLinksList.js.map +1 -0
- package/funcs/checkoutLinksUpdate.d.ts +17 -0
- package/funcs/checkoutLinksUpdate.d.ts.map +1 -0
- package/funcs/checkoutLinksUpdate.js +104 -0
- package/funcs/checkoutLinksUpdate.js.map +1 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/articlecreate.d.ts +6 -67
- package/models/components/articlecreate.d.ts.map +1 -1
- package/models/components/articlecreate.js +7 -47
- package/models/components/articlecreate.js.map +1 -1
- package/models/components/benefit.d.ts +28 -0
- package/models/components/benefit.d.ts.map +1 -0
- package/models/components/benefit.js +69 -0
- package/models/components/benefit.js.map +1 -0
- package/models/components/benefitbase.d.ts +0 -3
- package/models/components/benefitbase.d.ts.map +1 -1
- package/models/components/benefitbase.js.map +1 -1
- package/models/components/benefitgrantwebhook.d.ts +3 -28
- package/models/components/benefitgrantwebhook.d.ts.map +1 -1
- package/models/components/benefitgrantwebhook.js +4 -57
- package/models/components/benefitgrantwebhook.js.map +1 -1
- package/models/components/benefitinput.d.ts +28 -0
- package/models/components/benefitinput.d.ts.map +1 -0
- package/models/components/benefitinput.js +69 -0
- package/models/components/benefitinput.js.map +1 -0
- package/models/components/checkoutlink.d.ts +69 -0
- package/models/components/checkoutlink.d.ts.map +1 -0
- package/models/components/checkoutlink.js +90 -0
- package/models/components/checkoutlink.js.map +1 -0
- package/models/components/checkoutlinkcreate.d.ts +85 -0
- package/models/components/checkoutlinkcreate.d.ts.map +1 -0
- package/models/components/checkoutlinkcreate.js +90 -0
- package/models/components/checkoutlinkcreate.js.map +1 -0
- package/models/components/checkoutlinksortproperty.d.ts +28 -0
- package/models/components/checkoutlinksortproperty.d.ts.map +1 -0
- package/models/components/checkoutlinksortproperty.js +50 -0
- package/models/components/checkoutlinksortproperty.js.map +1 -0
- package/models/components/checkoutlinkupdate.d.ts +46 -0
- package/models/components/checkoutlinkupdate.d.ts.map +1 -0
- package/models/components/checkoutlinkupdate.js +61 -0
- package/models/components/checkoutlinkupdate.js.map +1 -0
- package/models/components/checkoutpublic.d.ts +5 -8
- package/models/components/checkoutpublic.d.ts.map +1 -1
- package/models/components/checkoutpublic.js +2 -2
- package/models/components/checkoutpublic.js.map +1 -1
- package/models/components/index.d.ts +13 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +13 -0
- package/models/components/index.js.map +1 -1
- package/models/components/interval.d.ts +37 -0
- package/models/components/interval.d.ts.map +1 -0
- package/models/components/interval.js +54 -0
- package/models/components/interval.js.map +1 -0
- package/models/components/issue.d.ts +0 -6
- package/models/components/issue.d.ts.map +1 -1
- package/models/components/issue.js.map +1 -1
- package/models/components/licensekeyread.d.ts +3 -0
- package/models/components/licensekeyread.d.ts.map +1 -1
- package/models/components/licensekeyread.js +3 -0
- package/models/components/licensekeyread.js.map +1 -1
- package/models/components/licensekeyuser.d.ts +31 -0
- package/models/components/licensekeyuser.d.ts.map +1 -0
- package/models/components/licensekeyuser.js +67 -0
- package/models/components/licensekeyuser.js.map +1 -0
- package/models/components/licensekeywithactivations.d.ts +3 -0
- package/models/components/licensekeywithactivations.d.ts.map +1 -1
- package/models/components/licensekeywithactivations.js +3 -0
- package/models/components/licensekeywithactivations.js.map +1 -1
- package/models/components/listresourcebenefit.d.ts +3 -28
- package/models/components/listresourcebenefit.d.ts.map +1 -1
- package/models/components/listresourcebenefit.js +4 -57
- package/models/components/listresourcebenefit.js.map +1 -1
- package/models/components/listresourcecheckoutlink.d.ts +29 -0
- package/models/components/listresourcecheckoutlink.d.ts.map +1 -0
- package/models/components/listresourcecheckoutlink.js +54 -0
- package/models/components/listresourcecheckoutlink.js.map +1 -0
- package/models/components/metric.d.ts +0 -3
- package/models/components/metric.d.ts.map +1 -1
- package/models/components/metric.js.map +1 -1
- package/models/components/metricsintervalslimits.d.ts +5 -5
- package/models/components/metricslimits.d.ts +1 -1
- package/models/components/metricsresponse.d.ts +0 -3
- package/models/components/metricsresponse.d.ts.map +1 -1
- package/models/components/metricsresponse.js.map +1 -1
- package/models/components/oauth2client.js +2 -2
- package/models/components/oauth2client.js.map +1 -1
- package/models/components/oauth2clientconfiguration.js +2 -2
- package/models/components/oauth2clientconfiguration.js.map +1 -1
- package/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/models/components/order.d.ts +3 -0
- package/models/components/order.d.ts.map +1 -1
- package/models/components/order.js +5 -0
- package/models/components/order.js.map +1 -1
- package/models/components/orderbillingreason.d.ts +34 -0
- package/models/components/orderbillingreason.d.ts.map +1 -0
- package/models/components/orderbillingreason.js +52 -0
- package/models/components/orderbillingreason.js.map +1 -0
- package/models/components/pledge.d.ts +0 -9
- package/models/components/pledge.d.ts.map +1 -1
- package/models/components/pledge.js.map +1 -1
- package/models/components/polarcheckoutschemascheckout.d.ts +2 -121
- package/models/components/polarcheckoutschemascheckout.d.ts.map +1 -1
- package/models/components/polarcheckoutschemascheckout.js +3 -108
- package/models/components/polarcheckoutschemascheckout.js.map +1 -1
- package/models/components/productpriceonetimecustom.d.ts +5 -0
- package/models/components/productpriceonetimecustom.d.ts.map +1 -1
- package/models/components/productpriceonetimecustom.js +4 -0
- package/models/components/productpriceonetimecustom.js.map +1 -1
- package/models/components/productpriceonetimefixed.d.ts +5 -0
- package/models/components/productpriceonetimefixed.d.ts.map +1 -1
- package/models/components/productpriceonetimefixed.js +4 -0
- package/models/components/productpriceonetimefixed.js.map +1 -1
- package/models/components/productpriceonetimefree.d.ts +5 -0
- package/models/components/productpriceonetimefree.d.ts.map +1 -1
- package/models/components/productpriceonetimefree.js +4 -0
- package/models/components/productpriceonetimefree.js.map +1 -1
- package/models/components/productpricerecurringcustom.d.ts +5 -3
- package/models/components/productpricerecurringcustom.d.ts.map +1 -1
- package/models/components/productpricerecurringcustom.js +4 -0
- package/models/components/productpricerecurringcustom.js.map +1 -1
- package/models/components/productpricerecurringfixed.d.ts +5 -3
- package/models/components/productpricerecurringfixed.d.ts.map +1 -1
- package/models/components/productpricerecurringfixed.js +4 -0
- package/models/components/productpricerecurringfixed.js.map +1 -1
- package/models/components/productpricerecurringfixedcreate.d.ts +0 -3
- package/models/components/productpricerecurringfixedcreate.d.ts.map +1 -1
- package/models/components/productpricerecurringfixedcreate.js.map +1 -1
- package/models/components/productpricerecurringfree.d.ts +5 -3
- package/models/components/productpricerecurringfree.d.ts.map +1 -1
- package/models/components/productpricerecurringfree.js +4 -0
- package/models/components/productpricerecurringfree.js.map +1 -1
- package/models/components/productpricerecurringfreecreate.d.ts +0 -3
- package/models/components/productpricerecurringfreecreate.d.ts.map +1 -1
- package/models/components/productpricerecurringfreecreate.js.map +1 -1
- package/models/components/validatedlicensekey.d.ts +3 -0
- package/models/components/validatedlicensekey.d.ts.map +1 -1
- package/models/components/validatedlicensekey.js +3 -0
- package/models/components/validatedlicensekey.js.map +1 -1
- package/models/components/webhookbenefitcreatedpayload.d.ts +3 -28
- package/models/components/webhookbenefitcreatedpayload.d.ts.map +1 -1
- package/models/components/webhookbenefitcreatedpayload.js +4 -57
- package/models/components/webhookbenefitcreatedpayload.js.map +1 -1
- package/models/components/webhookbenefitupdatedpayload.d.ts +3 -28
- package/models/components/webhookbenefitupdatedpayload.d.ts.map +1 -1
- package/models/components/webhookbenefitupdatedpayload.js +4 -57
- package/models/components/webhookbenefitupdatedpayload.js.map +1 -1
- package/models/components/webhookcheckoutcreatedpayload.d.ts +3 -3
- package/models/components/webhookcheckoutcreatedpayload.d.ts.map +1 -1
- package/models/components/webhookcheckoutcreatedpayload.js +2 -2
- package/models/components/webhookcheckoutcreatedpayload.js.map +1 -1
- package/models/components/webhookcheckoutupdatedpayload.d.ts +3 -3
- package/models/components/webhookcheckoutupdatedpayload.d.ts.map +1 -1
- package/models/components/webhookcheckoutupdatedpayload.js +2 -2
- package/models/components/webhookcheckoutupdatedpayload.js.map +1 -1
- package/models/components/webhooksubscriptionactivepayload.d.ts +59 -0
- package/models/components/webhooksubscriptionactivepayload.d.ts.map +1 -0
- package/models/components/webhooksubscriptionactivepayload.js +71 -0
- package/models/components/webhooksubscriptionactivepayload.js.map +1 -0
- package/models/components/webhooksubscriptioncanceledpayload.d.ts +59 -0
- package/models/components/webhooksubscriptioncanceledpayload.d.ts.map +1 -0
- package/models/components/webhooksubscriptioncanceledpayload.js +71 -0
- package/models/components/webhooksubscriptioncanceledpayload.js.map +1 -0
- package/models/components/webhooksubscriptionrevokedpayload.d.ts +59 -0
- package/models/components/webhooksubscriptionrevokedpayload.d.ts.map +1 -0
- package/models/components/webhooksubscriptionrevokedpayload.js +71 -0
- package/models/components/webhooksubscriptionrevokedpayload.js.map +1 -0
- package/models/components/webhooksubscriptionupdatedpayload.d.ts +6 -2
- package/models/components/webhooksubscriptionupdatedpayload.d.ts.map +1 -1
- package/models/components/webhooksubscriptionupdatedpayload.js.map +1 -1
- package/models/operations/articlesexport.d.ts +25 -0
- package/models/operations/articlesexport.d.ts.map +1 -0
- package/models/operations/articlesexport.js +59 -0
- package/models/operations/articlesexport.js.map +1 -0
- package/models/operations/benefitscreate.d.ts +0 -22
- package/models/operations/benefitscreate.d.ts.map +1 -1
- package/models/operations/benefitscreate.js +1 -32
- package/models/operations/benefitscreate.js.map +1 -1
- package/models/operations/benefitsget.d.ts +0 -23
- package/models/operations/benefitsget.d.ts.map +1 -1
- package/models/operations/benefitsget.js +1 -33
- package/models/operations/benefitsget.js.map +1 -1
- package/models/operations/benefitsupdate.d.ts +0 -22
- package/models/operations/benefitsupdate.d.ts.map +1 -1
- package/models/operations/benefitsupdate.js +1 -32
- package/models/operations/benefitsupdate.js.map +1 -1
- package/models/operations/checkoutlinksdelete.d.ts +28 -0
- package/models/operations/checkoutlinksdelete.d.ts.map +1 -0
- package/models/operations/checkoutlinksdelete.js +50 -0
- package/models/operations/checkoutlinksdelete.js.map +1 -0
- package/models/operations/checkoutlinksget.d.ts +28 -0
- package/models/operations/checkoutlinksget.d.ts.map +1 -0
- package/models/operations/checkoutlinksget.js +50 -0
- package/models/operations/checkoutlinksget.js.map +1 -0
- package/models/operations/checkoutlinkslist.d.ts +116 -0
- package/models/operations/checkoutlinkslist.d.ts.map +1 -0
- package/models/operations/checkoutlinkslist.js +129 -0
- package/models/operations/checkoutlinkslist.js.map +1 -0
- package/models/operations/checkoutlinksupdate.d.ts +31 -0
- package/models/operations/checkoutlinksupdate.d.ts.map +1 -0
- package/models/operations/checkoutlinksupdate.js +62 -0
- package/models/operations/checkoutlinksupdate.js.map +1 -0
- package/models/operations/index.d.ts +5 -0
- package/models/operations/index.d.ts.map +1 -1
- package/models/operations/index.js +5 -0
- package/models/operations/index.js.map +1 -1
- package/models/operations/metricsget.d.ts +1 -42
- package/models/operations/metricsget.d.ts.map +1 -1
- package/models/operations/metricsget.js +3 -29
- package/models/operations/metricsget.js.map +1 -1
- package/package.json +1 -1
- package/sdk/articles.d.ts +7 -0
- package/sdk/articles.d.ts.map +1 -1
- package/sdk/articles.js +10 -0
- package/sdk/articles.js.map +1 -1
- package/sdk/benefits.d.ts +4 -3
- package/sdk/benefits.d.ts.map +1 -1
- package/sdk/benefits.js.map +1 -1
- package/sdk/checkoutlinks.d.ts +42 -0
- package/sdk/checkoutlinks.d.ts.map +1 -0
- package/sdk/checkoutlinks.js +63 -0
- package/sdk/checkoutlinks.js.map +1 -0
- package/sdk/sdk.d.ts +3 -0
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +5 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/articlesExport.ts +129 -0
- package/src/funcs/benefitsCreate.ts +4 -3
- package/src/funcs/benefitsGet.ts +4 -3
- package/src/funcs/benefitsUpdate.ts +4 -3
- package/src/funcs/checkoutLinksCreate.ts +124 -0
- package/src/funcs/checkoutLinksDelete.ts +135 -0
- package/src/funcs/checkoutLinksGet.ts +134 -0
- package/src/funcs/checkoutLinksList.ts +189 -0
- package/src/funcs/checkoutLinksUpdate.ts +138 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/articlecreate.ts +18 -77
- package/src/models/components/benefit.ts +106 -0
- package/src/models/components/benefitbase.ts +0 -3
- package/src/models/components/benefitgrantwebhook.ts +9 -137
- package/src/models/components/benefitinput.ts +109 -0
- package/src/models/components/checkoutlink.ts +131 -0
- package/src/models/components/checkoutlinkcreate.ts +127 -0
- package/src/models/components/checkoutlinksortproperty.ts +35 -0
- package/src/models/components/checkoutlinkupdate.ts +73 -0
- package/src/models/components/checkoutpublic.ts +7 -10
- package/src/models/components/index.ts +13 -0
- package/src/models/components/interval.ts +34 -0
- package/src/models/components/issue.ts +0 -6
- package/src/models/components/licensekeyread.ts +10 -0
- package/src/models/components/licensekeyuser.ts +68 -0
- package/src/models/components/licensekeywithactivations.ts +10 -0
- package/src/models/components/listresourcebenefit.ts +9 -140
- package/src/models/components/listresourcecheckoutlink.ts +61 -0
- package/src/models/components/metric.ts +0 -3
- package/src/models/components/metricsintervalslimits.ts +5 -5
- package/src/models/components/metricslimits.ts +1 -1
- package/src/models/components/metricsresponse.ts +0 -3
- package/src/models/components/oauth2client.ts +2 -2
- package/src/models/components/oauth2clientconfiguration.ts +2 -2
- package/src/models/components/oauth2clientconfigurationupdate.ts +2 -2
- package/src/models/components/order.ts +11 -0
- package/src/models/components/orderbillingreason.ts +35 -0
- package/src/models/components/pledge.ts +0 -9
- package/src/models/components/polarcheckoutschemascheckout.ts +4 -229
- package/src/models/components/productpriceonetimecustom.ts +9 -0
- package/src/models/components/productpriceonetimefixed.ts +9 -0
- package/src/models/components/productpriceonetimefree.ts +9 -0
- package/src/models/components/productpricerecurringcustom.ts +9 -3
- package/src/models/components/productpricerecurringfixed.ts +9 -3
- package/src/models/components/productpricerecurringfixedcreate.ts +0 -3
- package/src/models/components/productpricerecurringfree.ts +9 -3
- package/src/models/components/productpricerecurringfreecreate.ts +0 -3
- package/src/models/components/validatedlicensekey.ts +10 -0
- package/src/models/components/webhookbenefitcreatedpayload.ts +9 -139
- package/src/models/components/webhookbenefitupdatedpayload.ts +9 -139
- package/src/models/components/webhookcheckoutcreatedpayload.ts +8 -8
- package/src/models/components/webhookcheckoutupdatedpayload.ts +8 -8
- package/src/models/components/webhooksubscriptionactivepayload.ts +95 -0
- package/src/models/components/webhooksubscriptioncanceledpayload.ts +96 -0
- package/src/models/components/webhooksubscriptionrevokedpayload.ts +96 -0
- package/src/models/components/webhooksubscriptionupdatedpayload.ts +6 -2
- package/src/models/operations/articlesexport.ts +54 -0
- package/src/models/operations/benefitscreate.ts +0 -67
- package/src/models/operations/benefitsget.ts +0 -66
- package/src/models/operations/benefitsupdate.ts +0 -67
- package/src/models/operations/checkoutlinksdelete.ts +48 -0
- package/src/models/operations/checkoutlinksget.ts +48 -0
- package/src/models/operations/checkoutlinkslist.ts +224 -0
- package/src/models/operations/checkoutlinksupdate.ts +62 -0
- package/src/models/operations/index.ts +5 -0
- package/src/models/operations/metricsget.ts +3 -38
- package/src/sdk/articles.ts +18 -0
- package/src/sdk/benefits.ts +4 -3
- package/src/sdk/checkoutlinks.ts +101 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -9,6 +9,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as components from "../models/components/index.js";
|
|
12
13
|
import {
|
|
13
14
|
ConnectionError,
|
|
14
15
|
InvalidRequestError,
|
|
@@ -34,7 +35,7 @@ export async function benefitsCreate(
|
|
|
34
35
|
options?: RequestOptions,
|
|
35
36
|
): Promise<
|
|
36
37
|
Result<
|
|
37
|
-
|
|
38
|
+
components.Benefit,
|
|
38
39
|
| errors.HTTPValidationError
|
|
39
40
|
| SDKError
|
|
40
41
|
| SDKValidationError
|
|
@@ -103,7 +104,7 @@ export async function benefitsCreate(
|
|
|
103
104
|
};
|
|
104
105
|
|
|
105
106
|
const [result] = await M.match<
|
|
106
|
-
|
|
107
|
+
components.Benefit,
|
|
107
108
|
| errors.HTTPValidationError
|
|
108
109
|
| SDKError
|
|
109
110
|
| SDKValidationError
|
|
@@ -113,7 +114,7 @@ export async function benefitsCreate(
|
|
|
113
114
|
| RequestTimeoutError
|
|
114
115
|
| ConnectionError
|
|
115
116
|
>(
|
|
116
|
-
M.json(201,
|
|
117
|
+
M.json(201, components.Benefit$inboundSchema),
|
|
117
118
|
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
118
119
|
M.fail(["4XX", "5XX"]),
|
|
119
120
|
)(response, { extraFields: responseFields });
|
package/src/funcs/benefitsGet.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as components from "../models/components/index.js";
|
|
12
13
|
import {
|
|
13
14
|
ConnectionError,
|
|
14
15
|
InvalidRequestError,
|
|
@@ -34,7 +35,7 @@ export async function benefitsGet(
|
|
|
34
35
|
options?: RequestOptions,
|
|
35
36
|
): Promise<
|
|
36
37
|
Result<
|
|
37
|
-
|
|
38
|
+
components.Benefit,
|
|
38
39
|
| errors.ResourceNotFound
|
|
39
40
|
| errors.HTTPValidationError
|
|
40
41
|
| SDKError
|
|
@@ -109,7 +110,7 @@ export async function benefitsGet(
|
|
|
109
110
|
};
|
|
110
111
|
|
|
111
112
|
const [result] = await M.match<
|
|
112
|
-
|
|
113
|
+
components.Benefit,
|
|
113
114
|
| errors.ResourceNotFound
|
|
114
115
|
| errors.HTTPValidationError
|
|
115
116
|
| SDKError
|
|
@@ -120,7 +121,7 @@ export async function benefitsGet(
|
|
|
120
121
|
| RequestTimeoutError
|
|
121
122
|
| ConnectionError
|
|
122
123
|
>(
|
|
123
|
-
M.json(200,
|
|
124
|
+
M.json(200, components.Benefit$inboundSchema),
|
|
124
125
|
M.jsonErr(404, errors.ResourceNotFound$inboundSchema),
|
|
125
126
|
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
126
127
|
M.fail(["4XX", "5XX"]),
|
|
@@ -9,6 +9,7 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
9
9
|
import { RequestOptions } from "../lib/sdks.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as components from "../models/components/index.js";
|
|
12
13
|
import {
|
|
13
14
|
ConnectionError,
|
|
14
15
|
InvalidRequestError,
|
|
@@ -34,7 +35,7 @@ export async function benefitsUpdate(
|
|
|
34
35
|
options?: RequestOptions,
|
|
35
36
|
): Promise<
|
|
36
37
|
Result<
|
|
37
|
-
|
|
38
|
+
components.Benefit,
|
|
38
39
|
| errors.NotPermitted
|
|
39
40
|
| errors.ResourceNotFound
|
|
40
41
|
| errors.HTTPValidationError
|
|
@@ -111,7 +112,7 @@ export async function benefitsUpdate(
|
|
|
111
112
|
};
|
|
112
113
|
|
|
113
114
|
const [result] = await M.match<
|
|
114
|
-
|
|
115
|
+
components.Benefit,
|
|
115
116
|
| errors.NotPermitted
|
|
116
117
|
| errors.ResourceNotFound
|
|
117
118
|
| errors.HTTPValidationError
|
|
@@ -123,7 +124,7 @@ export async function benefitsUpdate(
|
|
|
123
124
|
| RequestTimeoutError
|
|
124
125
|
| ConnectionError
|
|
125
126
|
>(
|
|
126
|
-
M.json(200,
|
|
127
|
+
M.json(200, components.Benefit$inboundSchema),
|
|
127
128
|
M.jsonErr(403, errors.NotPermitted$inboundSchema),
|
|
128
129
|
M.jsonErr(404, errors.ResourceNotFound$inboundSchema),
|
|
129
130
|
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PolarCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as components from "../models/components/index.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import { Result } from "../types/fp.js";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Create Checkout Link
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Create a checkout link.
|
|
30
|
+
*/
|
|
31
|
+
export async function checkoutLinksCreate(
|
|
32
|
+
client: PolarCore,
|
|
33
|
+
request: components.CheckoutLinkCreate,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): Promise<
|
|
36
|
+
Result<
|
|
37
|
+
components.CheckoutLink,
|
|
38
|
+
| errors.HTTPValidationError
|
|
39
|
+
| SDKError
|
|
40
|
+
| SDKValidationError
|
|
41
|
+
| UnexpectedClientError
|
|
42
|
+
| InvalidRequestError
|
|
43
|
+
| RequestAbortedError
|
|
44
|
+
| RequestTimeoutError
|
|
45
|
+
| ConnectionError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
const parsed = safeParse(
|
|
49
|
+
request,
|
|
50
|
+
(value) => components.CheckoutLinkCreate$outboundSchema.parse(value),
|
|
51
|
+
"Input validation failed",
|
|
52
|
+
);
|
|
53
|
+
if (!parsed.ok) {
|
|
54
|
+
return parsed;
|
|
55
|
+
}
|
|
56
|
+
const payload = parsed.value;
|
|
57
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
58
|
+
|
|
59
|
+
const path = pathToFunc("/v1/checkout-links/")();
|
|
60
|
+
|
|
61
|
+
const headers = new Headers({
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
Accept: "application/json",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const secConfig = await extractSecurity(client._options.accessToken);
|
|
67
|
+
const securityInput = secConfig == null ? {} : { accessToken: secConfig };
|
|
68
|
+
const context = {
|
|
69
|
+
operationID: "checkout-links:create",
|
|
70
|
+
oAuth2Scopes: [],
|
|
71
|
+
securitySource: client._options.accessToken,
|
|
72
|
+
};
|
|
73
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
74
|
+
|
|
75
|
+
const requestRes = client._createRequest(context, {
|
|
76
|
+
security: requestSecurity,
|
|
77
|
+
method: "POST",
|
|
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
|
+
|
|
88
|
+
const doResult = await client._do(req, {
|
|
89
|
+
context,
|
|
90
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
91
|
+
retryConfig: options?.retries
|
|
92
|
+
|| client._options.retryConfig,
|
|
93
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
94
|
+
});
|
|
95
|
+
if (!doResult.ok) {
|
|
96
|
+
return doResult;
|
|
97
|
+
}
|
|
98
|
+
const response = doResult.value;
|
|
99
|
+
|
|
100
|
+
const responseFields = {
|
|
101
|
+
HttpMeta: { Response: response, Request: req },
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
const [result] = await M.match<
|
|
105
|
+
components.CheckoutLink,
|
|
106
|
+
| errors.HTTPValidationError
|
|
107
|
+
| SDKError
|
|
108
|
+
| SDKValidationError
|
|
109
|
+
| UnexpectedClientError
|
|
110
|
+
| InvalidRequestError
|
|
111
|
+
| RequestAbortedError
|
|
112
|
+
| RequestTimeoutError
|
|
113
|
+
| ConnectionError
|
|
114
|
+
>(
|
|
115
|
+
M.json(201, components.CheckoutLink$inboundSchema),
|
|
116
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
117
|
+
M.fail(["4XX", "5XX"]),
|
|
118
|
+
)(response, { extraFields: responseFields });
|
|
119
|
+
if (!result.ok) {
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return result;
|
|
124
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { PolarCore } from "../core.js";
|
|
7
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Delete Checkout Link
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Delete a checkout link.
|
|
31
|
+
*/
|
|
32
|
+
export async function checkoutLinksDelete(
|
|
33
|
+
client: PolarCore,
|
|
34
|
+
request: operations.CheckoutLinksDeleteRequest,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): Promise<
|
|
37
|
+
Result<
|
|
38
|
+
void,
|
|
39
|
+
| errors.ResourceNotFound
|
|
40
|
+
| errors.HTTPValidationError
|
|
41
|
+
| SDKError
|
|
42
|
+
| SDKValidationError
|
|
43
|
+
| UnexpectedClientError
|
|
44
|
+
| InvalidRequestError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
const parsed = safeParse(
|
|
51
|
+
request,
|
|
52
|
+
(value) =>
|
|
53
|
+
operations.CheckoutLinksDeleteRequest$outboundSchema.parse(value),
|
|
54
|
+
"Input validation failed",
|
|
55
|
+
);
|
|
56
|
+
if (!parsed.ok) {
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
const payload = parsed.value;
|
|
60
|
+
const body = null;
|
|
61
|
+
|
|
62
|
+
const pathParams = {
|
|
63
|
+
id: encodeSimple("id", payload.id, {
|
|
64
|
+
explode: false,
|
|
65
|
+
charEncoding: "percent",
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const path = pathToFunc("/v1/checkout-links/{id}")(pathParams);
|
|
70
|
+
|
|
71
|
+
const headers = new Headers({
|
|
72
|
+
Accept: "application/json",
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
const secConfig = await extractSecurity(client._options.accessToken);
|
|
76
|
+
const securityInput = secConfig == null ? {} : { accessToken: secConfig };
|
|
77
|
+
const context = {
|
|
78
|
+
operationID: "checkout-links:delete",
|
|
79
|
+
oAuth2Scopes: [],
|
|
80
|
+
securitySource: client._options.accessToken,
|
|
81
|
+
};
|
|
82
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
83
|
+
|
|
84
|
+
const requestRes = client._createRequest(context, {
|
|
85
|
+
security: requestSecurity,
|
|
86
|
+
method: "DELETE",
|
|
87
|
+
path: path,
|
|
88
|
+
headers: headers,
|
|
89
|
+
body: body,
|
|
90
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
91
|
+
}, options);
|
|
92
|
+
if (!requestRes.ok) {
|
|
93
|
+
return requestRes;
|
|
94
|
+
}
|
|
95
|
+
const req = requestRes.value;
|
|
96
|
+
|
|
97
|
+
const doResult = await client._do(req, {
|
|
98
|
+
context,
|
|
99
|
+
errorCodes: ["404", "422", "4XX", "5XX"],
|
|
100
|
+
retryConfig: options?.retries
|
|
101
|
+
|| client._options.retryConfig,
|
|
102
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
103
|
+
});
|
|
104
|
+
if (!doResult.ok) {
|
|
105
|
+
return doResult;
|
|
106
|
+
}
|
|
107
|
+
const response = doResult.value;
|
|
108
|
+
|
|
109
|
+
const responseFields = {
|
|
110
|
+
HttpMeta: { Response: response, Request: req },
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const [result] = await M.match<
|
|
114
|
+
void,
|
|
115
|
+
| errors.ResourceNotFound
|
|
116
|
+
| errors.HTTPValidationError
|
|
117
|
+
| SDKError
|
|
118
|
+
| SDKValidationError
|
|
119
|
+
| UnexpectedClientError
|
|
120
|
+
| InvalidRequestError
|
|
121
|
+
| RequestAbortedError
|
|
122
|
+
| RequestTimeoutError
|
|
123
|
+
| ConnectionError
|
|
124
|
+
>(
|
|
125
|
+
M.nil(204, z.void()),
|
|
126
|
+
M.jsonErr(404, errors.ResourceNotFound$inboundSchema),
|
|
127
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
128
|
+
M.fail(["4XX", "5XX"]),
|
|
129
|
+
)(response, { extraFields: responseFields });
|
|
130
|
+
if (!result.ok) {
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PolarCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
10
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
|
+
import { pathToFunc } from "../lib/url.js";
|
|
12
|
+
import * as components from "../models/components/index.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Get Checkout Link
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* Get a checkout link by ID.
|
|
31
|
+
*/
|
|
32
|
+
export async function checkoutLinksGet(
|
|
33
|
+
client: PolarCore,
|
|
34
|
+
request: operations.CheckoutLinksGetRequest,
|
|
35
|
+
options?: RequestOptions,
|
|
36
|
+
): Promise<
|
|
37
|
+
Result<
|
|
38
|
+
components.CheckoutLink,
|
|
39
|
+
| errors.ResourceNotFound
|
|
40
|
+
| errors.HTTPValidationError
|
|
41
|
+
| SDKError
|
|
42
|
+
| SDKValidationError
|
|
43
|
+
| UnexpectedClientError
|
|
44
|
+
| InvalidRequestError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
>
|
|
49
|
+
> {
|
|
50
|
+
const parsed = safeParse(
|
|
51
|
+
request,
|
|
52
|
+
(value) => operations.CheckoutLinksGetRequest$outboundSchema.parse(value),
|
|
53
|
+
"Input validation failed",
|
|
54
|
+
);
|
|
55
|
+
if (!parsed.ok) {
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
const payload = parsed.value;
|
|
59
|
+
const body = null;
|
|
60
|
+
|
|
61
|
+
const pathParams = {
|
|
62
|
+
id: encodeSimple("id", payload.id, {
|
|
63
|
+
explode: false,
|
|
64
|
+
charEncoding: "percent",
|
|
65
|
+
}),
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const path = pathToFunc("/v1/checkout-links/{id}")(pathParams);
|
|
69
|
+
|
|
70
|
+
const headers = new Headers({
|
|
71
|
+
Accept: "application/json",
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const secConfig = await extractSecurity(client._options.accessToken);
|
|
75
|
+
const securityInput = secConfig == null ? {} : { accessToken: secConfig };
|
|
76
|
+
const context = {
|
|
77
|
+
operationID: "checkout-links:get",
|
|
78
|
+
oAuth2Scopes: [],
|
|
79
|
+
securitySource: client._options.accessToken,
|
|
80
|
+
};
|
|
81
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
82
|
+
|
|
83
|
+
const requestRes = client._createRequest(context, {
|
|
84
|
+
security: requestSecurity,
|
|
85
|
+
method: "GET",
|
|
86
|
+
path: path,
|
|
87
|
+
headers: headers,
|
|
88
|
+
body: body,
|
|
89
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
90
|
+
}, options);
|
|
91
|
+
if (!requestRes.ok) {
|
|
92
|
+
return requestRes;
|
|
93
|
+
}
|
|
94
|
+
const req = requestRes.value;
|
|
95
|
+
|
|
96
|
+
const doResult = await client._do(req, {
|
|
97
|
+
context,
|
|
98
|
+
errorCodes: ["404", "422", "4XX", "5XX"],
|
|
99
|
+
retryConfig: options?.retries
|
|
100
|
+
|| client._options.retryConfig,
|
|
101
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
102
|
+
});
|
|
103
|
+
if (!doResult.ok) {
|
|
104
|
+
return doResult;
|
|
105
|
+
}
|
|
106
|
+
const response = doResult.value;
|
|
107
|
+
|
|
108
|
+
const responseFields = {
|
|
109
|
+
HttpMeta: { Response: response, Request: req },
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const [result] = await M.match<
|
|
113
|
+
components.CheckoutLink,
|
|
114
|
+
| errors.ResourceNotFound
|
|
115
|
+
| errors.HTTPValidationError
|
|
116
|
+
| SDKError
|
|
117
|
+
| SDKValidationError
|
|
118
|
+
| UnexpectedClientError
|
|
119
|
+
| InvalidRequestError
|
|
120
|
+
| RequestAbortedError
|
|
121
|
+
| RequestTimeoutError
|
|
122
|
+
| ConnectionError
|
|
123
|
+
>(
|
|
124
|
+
M.json(200, components.CheckoutLink$inboundSchema),
|
|
125
|
+
M.jsonErr(404, errors.ResourceNotFound$inboundSchema),
|
|
126
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
127
|
+
M.fail(["4XX", "5XX"]),
|
|
128
|
+
)(response, { extraFields: responseFields });
|
|
129
|
+
if (!result.ok) {
|
|
130
|
+
return result;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PolarCore } from "../core.js";
|
|
6
|
+
import { dlv } from "../lib/dlv.js";
|
|
7
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import {
|
|
14
|
+
ConnectionError,
|
|
15
|
+
InvalidRequestError,
|
|
16
|
+
RequestAbortedError,
|
|
17
|
+
RequestTimeoutError,
|
|
18
|
+
UnexpectedClientError,
|
|
19
|
+
} from "../models/errors/httpclienterrors.js";
|
|
20
|
+
import * as errors from "../models/errors/index.js";
|
|
21
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
import {
|
|
26
|
+
createPageIterator,
|
|
27
|
+
haltIterator,
|
|
28
|
+
PageIterator,
|
|
29
|
+
Paginator,
|
|
30
|
+
} from "../types/operations.js";
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* List Checkout Links
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* List checkout links.
|
|
37
|
+
*/
|
|
38
|
+
export async function checkoutLinksList(
|
|
39
|
+
client: PolarCore,
|
|
40
|
+
request: operations.CheckoutLinksListRequest,
|
|
41
|
+
options?: RequestOptions,
|
|
42
|
+
): Promise<
|
|
43
|
+
PageIterator<
|
|
44
|
+
Result<
|
|
45
|
+
operations.CheckoutLinksListResponse,
|
|
46
|
+
| errors.HTTPValidationError
|
|
47
|
+
| SDKError
|
|
48
|
+
| SDKValidationError
|
|
49
|
+
| UnexpectedClientError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| ConnectionError
|
|
54
|
+
>
|
|
55
|
+
>
|
|
56
|
+
> {
|
|
57
|
+
const parsed = safeParse(
|
|
58
|
+
request,
|
|
59
|
+
(value) => operations.CheckoutLinksListRequest$outboundSchema.parse(value),
|
|
60
|
+
"Input validation failed",
|
|
61
|
+
);
|
|
62
|
+
if (!parsed.ok) {
|
|
63
|
+
return haltIterator(parsed);
|
|
64
|
+
}
|
|
65
|
+
const payload = parsed.value;
|
|
66
|
+
const body = null;
|
|
67
|
+
|
|
68
|
+
const path = pathToFunc("/v1/checkout-links/")();
|
|
69
|
+
|
|
70
|
+
const query = encodeFormQuery({
|
|
71
|
+
"limit": payload.limit,
|
|
72
|
+
"organization_id": payload.organization_id,
|
|
73
|
+
"page": payload.page,
|
|
74
|
+
"product_id": payload.product_id,
|
|
75
|
+
"sorting": payload.sorting,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const headers = new Headers({
|
|
79
|
+
Accept: "application/json",
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const secConfig = await extractSecurity(client._options.accessToken);
|
|
83
|
+
const securityInput = secConfig == null ? {} : { accessToken: secConfig };
|
|
84
|
+
const context = {
|
|
85
|
+
operationID: "checkout-links:list",
|
|
86
|
+
oAuth2Scopes: [],
|
|
87
|
+
securitySource: client._options.accessToken,
|
|
88
|
+
};
|
|
89
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
90
|
+
|
|
91
|
+
const requestRes = client._createRequest(context, {
|
|
92
|
+
security: requestSecurity,
|
|
93
|
+
method: "GET",
|
|
94
|
+
path: path,
|
|
95
|
+
headers: headers,
|
|
96
|
+
query: query,
|
|
97
|
+
body: body,
|
|
98
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
99
|
+
}, options);
|
|
100
|
+
if (!requestRes.ok) {
|
|
101
|
+
return haltIterator(requestRes);
|
|
102
|
+
}
|
|
103
|
+
const req = requestRes.value;
|
|
104
|
+
|
|
105
|
+
const doResult = await client._do(req, {
|
|
106
|
+
context,
|
|
107
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
108
|
+
retryConfig: options?.retries
|
|
109
|
+
|| client._options.retryConfig,
|
|
110
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
111
|
+
});
|
|
112
|
+
if (!doResult.ok) {
|
|
113
|
+
return haltIterator(doResult);
|
|
114
|
+
}
|
|
115
|
+
const response = doResult.value;
|
|
116
|
+
|
|
117
|
+
const responseFields = {
|
|
118
|
+
HttpMeta: { Response: response, Request: req },
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const [result, raw] = await M.match<
|
|
122
|
+
operations.CheckoutLinksListResponse,
|
|
123
|
+
| errors.HTTPValidationError
|
|
124
|
+
| SDKError
|
|
125
|
+
| SDKValidationError
|
|
126
|
+
| UnexpectedClientError
|
|
127
|
+
| InvalidRequestError
|
|
128
|
+
| RequestAbortedError
|
|
129
|
+
| RequestTimeoutError
|
|
130
|
+
| ConnectionError
|
|
131
|
+
>(
|
|
132
|
+
M.json(200, operations.CheckoutLinksListResponse$inboundSchema, {
|
|
133
|
+
key: "Result",
|
|
134
|
+
}),
|
|
135
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
136
|
+
M.fail(["4XX", "5XX"]),
|
|
137
|
+
)(response, { extraFields: responseFields });
|
|
138
|
+
if (!result.ok) {
|
|
139
|
+
return haltIterator(result);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const nextFunc = (
|
|
143
|
+
responseData: unknown,
|
|
144
|
+
): Paginator<
|
|
145
|
+
Result<
|
|
146
|
+
operations.CheckoutLinksListResponse,
|
|
147
|
+
| errors.HTTPValidationError
|
|
148
|
+
| SDKError
|
|
149
|
+
| SDKValidationError
|
|
150
|
+
| UnexpectedClientError
|
|
151
|
+
| InvalidRequestError
|
|
152
|
+
| RequestAbortedError
|
|
153
|
+
| RequestTimeoutError
|
|
154
|
+
| ConnectionError
|
|
155
|
+
>
|
|
156
|
+
> => {
|
|
157
|
+
const page = request?.page || 0;
|
|
158
|
+
const nextPage = page + 1;
|
|
159
|
+
const numPages = dlv(responseData, "pagination.max_page");
|
|
160
|
+
if (numPages == null || numPages <= page) {
|
|
161
|
+
return () => null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (!responseData) {
|
|
165
|
+
return () => null;
|
|
166
|
+
}
|
|
167
|
+
const results = dlv(responseData, "items");
|
|
168
|
+
if (!Array.isArray(results) || !results.length) {
|
|
169
|
+
return () => null;
|
|
170
|
+
}
|
|
171
|
+
const limit = request?.limit || 0;
|
|
172
|
+
if (results.length < limit) {
|
|
173
|
+
return () => null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return () =>
|
|
177
|
+
checkoutLinksList(
|
|
178
|
+
client,
|
|
179
|
+
{
|
|
180
|
+
...request,
|
|
181
|
+
page: nextPage,
|
|
182
|
+
},
|
|
183
|
+
options,
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const page = { ...result, next: nextFunc(raw) };
|
|
188
|
+
return { ...page, ...createPageIterator(page, (v) => !v.ok) };
|
|
189
|
+
}
|