@polar-sh/sdk 0.19.0 → 0.19.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 +9 -0
- package/docs/sdks/benefits/README.md +0 -1
- package/docs/sdks/customersessions/README.md +85 -0
- package/funcs/customerSessionsCreate.d.ts +16 -0
- package/funcs/customerSessionsCreate.d.ts.map +1 -0
- package/funcs/customerSessionsCreate.js +100 -0
- package/funcs/customerSessionsCreate.js.map +1 -0
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/benefitcreate.d.ts +4 -4
- package/models/components/benefitcreate.d.ts.map +1 -1
- package/models/components/benefitcreate.js +6 -6
- package/models/components/benefitcreate.js.map +1 -1
- package/models/components/benefitcustom.d.ts +1 -1
- package/models/components/benefitcustomcreate.d.ts +0 -5
- package/models/components/benefitcustomcreate.d.ts.map +1 -1
- package/models/components/benefitcustomcreate.js +0 -4
- package/models/components/benefitcustomcreate.js.map +1 -1
- package/models/components/benefitgithubrepositoryproperties.d.ts +5 -0
- package/models/components/benefitgithubrepositoryproperties.d.ts.map +1 -1
- package/models/components/benefitgithubrepositoryproperties.js +4 -0
- package/models/components/benefitgithubrepositoryproperties.js.map +1 -1
- package/models/components/checkout.d.ts +27 -0
- package/models/components/checkout.d.ts.map +1 -1
- package/models/components/checkout.js +28 -1
- package/models/components/checkout.js.map +1 -1
- package/models/components/checkoutlinkupdate.d.ts +0 -14
- package/models/components/checkoutlinkupdate.d.ts.map +1 -1
- package/models/components/checkoutlinkupdate.js.map +1 -1
- package/models/components/checkoutpricecreate.d.ts +41 -0
- package/models/components/checkoutpricecreate.d.ts.map +1 -1
- package/models/components/checkoutpricecreate.js +28 -1
- package/models/components/checkoutpricecreate.js.map +1 -1
- package/models/components/checkoutproductcreate.d.ts +41 -0
- package/models/components/checkoutproductcreate.d.ts.map +1 -1
- package/models/components/checkoutproductcreate.js +28 -1
- package/models/components/checkoutproductcreate.js.map +1 -1
- package/models/components/checkoutupdate.d.ts +38 -11
- package/models/components/checkoutupdate.d.ts.map +1 -1
- package/models/components/checkoutupdate.js +28 -1
- package/models/components/checkoutupdate.js.map +1 -1
- package/models/components/customer.d.ts +13 -13
- package/models/components/customer.d.ts.map +1 -1
- package/models/components/customer.js +16 -16
- package/models/components/customer.js.map +1 -1
- package/models/components/customersession.d.ts +57 -0
- package/models/components/customersession.d.ts.map +1 -0
- package/models/components/customersession.js +87 -0
- package/models/components/customersession.js.map +1 -0
- package/models/components/customersessioncreate.d.ts +35 -0
- package/models/components/customersessioncreate.d.ts.map +1 -0
- package/models/components/customersessioncreate.js +68 -0
- package/models/components/customersessioncreate.js.map +1 -0
- package/models/components/customfieldupdatecheckbox.d.ts +0 -14
- package/models/components/customfieldupdatecheckbox.d.ts.map +1 -1
- package/models/components/customfieldupdatecheckbox.js.map +1 -1
- package/models/components/customfieldupdatedate.d.ts +0 -14
- package/models/components/customfieldupdatedate.d.ts.map +1 -1
- package/models/components/customfieldupdatedate.js.map +1 -1
- package/models/components/customfieldupdatenumber.d.ts +0 -14
- package/models/components/customfieldupdatenumber.d.ts.map +1 -1
- package/models/components/customfieldupdatenumber.js.map +1 -1
- package/models/components/customfieldupdateselect.d.ts +0 -14
- package/models/components/customfieldupdateselect.d.ts.map +1 -1
- package/models/components/customfieldupdateselect.js.map +1 -1
- package/models/components/customfieldupdatetext.d.ts +0 -14
- package/models/components/customfieldupdatetext.d.ts.map +1 -1
- package/models/components/customfieldupdatetext.js.map +1 -1
- package/models/components/discountupdate.d.ts +0 -14
- package/models/components/discountupdate.d.ts.map +1 -1
- package/models/components/discountupdate.js.map +1 -1
- package/models/components/index.d.ts +2 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +2 -0
- package/models/components/index.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/ordersubscription.d.ts +5 -0
- package/models/components/ordersubscription.d.ts.map +1 -1
- package/models/components/ordersubscription.js +4 -0
- package/models/components/ordersubscription.js.map +1 -1
- package/models/components/orderuser.d.ts +2 -0
- package/models/components/orderuser.d.ts.map +1 -1
- package/models/components/orderuser.js +4 -0
- package/models/components/orderuser.js.map +1 -1
- package/models/components/productupdate.d.ts +0 -14
- package/models/components/productupdate.d.ts.map +1 -1
- package/models/components/productupdate.js.map +1 -1
- package/models/components/scope.d.ts +3 -0
- package/models/components/scope.d.ts.map +1 -1
- package/models/components/scope.js +1 -0
- package/models/components/scope.js.map +1 -1
- package/models/components/subscriptionuser.d.ts +2 -0
- package/models/components/subscriptionuser.d.ts.map +1 -1
- package/models/components/subscriptionuser.js +4 -0
- package/models/components/subscriptionuser.js.map +1 -1
- package/package.json +1 -1
- package/sdk/customersessions.d.ts +12 -0
- package/sdk/customersessions.d.ts.map +1 -0
- package/sdk/customersessions.js +22 -0
- package/sdk/customersessions.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/customerSessionsCreate.ts +132 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/benefitcreate.ts +14 -14
- package/src/models/components/benefitcustom.ts +1 -1
- package/src/models/components/benefitcustomcreate.ts +0 -9
- package/src/models/components/benefitgithubrepositoryproperties.ts +9 -0
- package/src/models/components/checkout.ts +60 -0
- package/src/models/components/checkoutlinkupdate.ts +0 -14
- package/src/models/components/checkoutpricecreate.ts +82 -0
- package/src/models/components/checkoutproductcreate.ts +82 -0
- package/src/models/components/checkoutupdate.ts +79 -11
- package/src/models/components/customer.ts +21 -21
- package/src/models/components/customersession.ts +126 -0
- package/src/models/components/customersessioncreate.ts +81 -0
- package/src/models/components/customfieldupdatecheckbox.ts +0 -14
- package/src/models/components/customfieldupdatedate.ts +0 -14
- package/src/models/components/customfieldupdatenumber.ts +0 -14
- package/src/models/components/customfieldupdateselect.ts +0 -14
- package/src/models/components/customfieldupdatetext.ts +0 -14
- package/src/models/components/discountupdate.ts +0 -14
- package/src/models/components/index.ts +2 -0
- 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/ordersubscription.ts +9 -0
- package/src/models/components/orderuser.ts +6 -0
- package/src/models/components/productupdate.ts +0 -14
- package/src/models/components/scope.ts +1 -0
- package/src/models/components/subscriptionuser.ts +6 -0
- package/src/sdk/customersessions.ts +27 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,132 @@
|
|
|
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 Customer Session
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Create a customer session.
|
|
30
|
+
*/
|
|
31
|
+
export async function customerSessionsCreate(
|
|
32
|
+
client: PolarCore,
|
|
33
|
+
request: components.CustomerSessionCreate,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): Promise<
|
|
36
|
+
Result<
|
|
37
|
+
components.CustomerSession,
|
|
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.CustomerSessionCreate$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/customer-sessions/")();
|
|
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 requestSecurity = resolveGlobalSecurity(securityInput);
|
|
69
|
+
|
|
70
|
+
const context = {
|
|
71
|
+
operationID: "customer-sessions:create",
|
|
72
|
+
oAuth2Scopes: [],
|
|
73
|
+
|
|
74
|
+
resolvedSecurity: requestSecurity,
|
|
75
|
+
|
|
76
|
+
securitySource: client._options.accessToken,
|
|
77
|
+
retryConfig: options?.retries
|
|
78
|
+
|| client._options.retryConfig
|
|
79
|
+
|| { strategy: "none" },
|
|
80
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const requestRes = client._createRequest(context, {
|
|
84
|
+
security: requestSecurity,
|
|
85
|
+
method: "POST",
|
|
86
|
+
baseURL: options?.serverURL,
|
|
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: ["422", "4XX", "5XX"],
|
|
100
|
+
retryConfig: context.retryConfig,
|
|
101
|
+
retryCodes: context.retryCodes,
|
|
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.CustomerSession,
|
|
114
|
+
| errors.HTTPValidationError
|
|
115
|
+
| SDKError
|
|
116
|
+
| SDKValidationError
|
|
117
|
+
| UnexpectedClientError
|
|
118
|
+
| InvalidRequestError
|
|
119
|
+
| RequestAbortedError
|
|
120
|
+
| RequestTimeoutError
|
|
121
|
+
| ConnectionError
|
|
122
|
+
>(
|
|
123
|
+
M.json(201, components.CustomerSession$inboundSchema),
|
|
124
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
125
|
+
M.fail(["4XX", "5XX"]),
|
|
126
|
+
)(response, { extraFields: responseFields });
|
|
127
|
+
if (!result.ok) {
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return result;
|
|
132
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -60,7 +60,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
60
60
|
export const SDK_METADATA = {
|
|
61
61
|
language: "typescript",
|
|
62
62
|
openapiDocVersion: "0.1.0",
|
|
63
|
-
sdkVersion: "0.19.
|
|
64
|
-
genVersion: "2.
|
|
65
|
-
userAgent: "speakeasy-sdk/typescript 0.19.
|
|
63
|
+
sdkVersion: "0.19.2",
|
|
64
|
+
genVersion: "2.481.0",
|
|
65
|
+
userAgent: "speakeasy-sdk/typescript 0.19.2 2.481.0 0.1.0 @polar-sh/sdk",
|
|
66
66
|
} as const;
|
|
@@ -45,11 +45,11 @@ import {
|
|
|
45
45
|
|
|
46
46
|
export type BenefitCreate =
|
|
47
47
|
| (BenefitAdsCreate & { type: "ads" })
|
|
48
|
+
| (BenefitCustomCreate & { type: "custom" })
|
|
48
49
|
| (BenefitDiscordCreate & { type: "discord" })
|
|
49
50
|
| (BenefitDownloadablesCreate & { type: "downloadables" })
|
|
50
51
|
| (BenefitGitHubRepositoryCreate & { type: "github_repository" })
|
|
51
|
-
| (BenefitLicenseKeysCreate & { type: "license_keys" })
|
|
52
|
-
| (BenefitCustomCreate & { type: "custom" });
|
|
52
|
+
| (BenefitLicenseKeysCreate & { type: "license_keys" });
|
|
53
53
|
|
|
54
54
|
/** @internal */
|
|
55
55
|
export const BenefitCreate$inboundSchema: z.ZodType<
|
|
@@ -60,6 +60,11 @@ export const BenefitCreate$inboundSchema: z.ZodType<
|
|
|
60
60
|
BenefitAdsCreate$inboundSchema.and(
|
|
61
61
|
z.object({ type: z.literal("ads") }).transform((v) => ({ type: v.type })),
|
|
62
62
|
),
|
|
63
|
+
BenefitCustomCreate$inboundSchema.and(
|
|
64
|
+
z.object({ type: z.literal("custom") }).transform((v) => ({
|
|
65
|
+
type: v.type,
|
|
66
|
+
})),
|
|
67
|
+
),
|
|
63
68
|
BenefitDiscordCreate$inboundSchema.and(
|
|
64
69
|
z.object({ type: z.literal("discord") }).transform((v) => ({
|
|
65
70
|
type: v.type,
|
|
@@ -80,21 +85,16 @@ export const BenefitCreate$inboundSchema: z.ZodType<
|
|
|
80
85
|
type: v.type,
|
|
81
86
|
})),
|
|
82
87
|
),
|
|
83
|
-
BenefitCustomCreate$inboundSchema.and(
|
|
84
|
-
z.object({ type: z.literal("custom") }).transform((v) => ({
|
|
85
|
-
type: v.type,
|
|
86
|
-
})),
|
|
87
|
-
),
|
|
88
88
|
]);
|
|
89
89
|
|
|
90
90
|
/** @internal */
|
|
91
91
|
export type BenefitCreate$Outbound =
|
|
92
92
|
| (BenefitAdsCreate$Outbound & { type: "ads" })
|
|
93
|
+
| (BenefitCustomCreate$Outbound & { type: "custom" })
|
|
93
94
|
| (BenefitDiscordCreate$Outbound & { type: "discord" })
|
|
94
95
|
| (BenefitDownloadablesCreate$Outbound & { type: "downloadables" })
|
|
95
96
|
| (BenefitGitHubRepositoryCreate$Outbound & { type: "github_repository" })
|
|
96
|
-
| (BenefitLicenseKeysCreate$Outbound & { type: "license_keys" })
|
|
97
|
-
| (BenefitCustomCreate$Outbound & { type: "custom" });
|
|
97
|
+
| (BenefitLicenseKeysCreate$Outbound & { type: "license_keys" });
|
|
98
98
|
|
|
99
99
|
/** @internal */
|
|
100
100
|
export const BenefitCreate$outboundSchema: z.ZodType<
|
|
@@ -105,6 +105,11 @@ export const BenefitCreate$outboundSchema: z.ZodType<
|
|
|
105
105
|
BenefitAdsCreate$outboundSchema.and(
|
|
106
106
|
z.object({ type: z.literal("ads") }).transform((v) => ({ type: v.type })),
|
|
107
107
|
),
|
|
108
|
+
BenefitCustomCreate$outboundSchema.and(
|
|
109
|
+
z.object({ type: z.literal("custom") }).transform((v) => ({
|
|
110
|
+
type: v.type,
|
|
111
|
+
})),
|
|
112
|
+
),
|
|
108
113
|
BenefitDiscordCreate$outboundSchema.and(
|
|
109
114
|
z.object({ type: z.literal("discord") }).transform((v) => ({
|
|
110
115
|
type: v.type,
|
|
@@ -125,11 +130,6 @@ export const BenefitCreate$outboundSchema: z.ZodType<
|
|
|
125
130
|
type: v.type,
|
|
126
131
|
})),
|
|
127
132
|
),
|
|
128
|
-
BenefitCustomCreate$outboundSchema.and(
|
|
129
|
-
z.object({ type: z.literal("custom") }).transform((v) => ({
|
|
130
|
-
type: v.type,
|
|
131
|
-
})),
|
|
132
|
-
),
|
|
133
133
|
]);
|
|
134
134
|
|
|
135
135
|
/**
|
|
@@ -62,7 +62,7 @@ export type BenefitCustom = {
|
|
|
62
62
|
*/
|
|
63
63
|
properties: BenefitCustomProperties;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
66
66
|
*/
|
|
67
67
|
isTaxApplicable: boolean;
|
|
68
68
|
};
|
|
@@ -35,10 +35,6 @@ export type BenefitCustomCreate = {
|
|
|
35
35
|
* The ID of the organization owning the benefit. **Required unless you use an organization token.**
|
|
36
36
|
*/
|
|
37
37
|
organizationId?: string | null | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Whether the benefit is taxable.
|
|
40
|
-
*/
|
|
41
|
-
isTaxApplicable: boolean;
|
|
42
38
|
/**
|
|
43
39
|
* Properties for creating a benefit of type `custom`.
|
|
44
40
|
*/
|
|
@@ -75,12 +71,10 @@ export const BenefitCustomCreate$inboundSchema: z.ZodType<
|
|
|
75
71
|
type: z.literal("custom").optional(),
|
|
76
72
|
description: z.string(),
|
|
77
73
|
organization_id: z.nullable(z.string()).optional(),
|
|
78
|
-
is_tax_applicable: z.boolean(),
|
|
79
74
|
properties: BenefitCustomCreateProperties$inboundSchema,
|
|
80
75
|
}).transform((v) => {
|
|
81
76
|
return remap$(v, {
|
|
82
77
|
"organization_id": "organizationId",
|
|
83
|
-
"is_tax_applicable": "isTaxApplicable",
|
|
84
78
|
});
|
|
85
79
|
});
|
|
86
80
|
|
|
@@ -89,7 +83,6 @@ export type BenefitCustomCreate$Outbound = {
|
|
|
89
83
|
type: "custom";
|
|
90
84
|
description: string;
|
|
91
85
|
organization_id?: string | null | undefined;
|
|
92
|
-
is_tax_applicable: boolean;
|
|
93
86
|
properties: BenefitCustomCreateProperties$Outbound;
|
|
94
87
|
};
|
|
95
88
|
|
|
@@ -102,12 +95,10 @@ export const BenefitCustomCreate$outboundSchema: z.ZodType<
|
|
|
102
95
|
type: z.literal("custom").default("custom"),
|
|
103
96
|
description: z.string(),
|
|
104
97
|
organizationId: z.nullable(z.string()).optional(),
|
|
105
|
-
isTaxApplicable: z.boolean(),
|
|
106
98
|
properties: BenefitCustomCreateProperties$outboundSchema,
|
|
107
99
|
}).transform((v) => {
|
|
108
100
|
return remap$(v, {
|
|
109
101
|
organizationId: "organization_id",
|
|
110
|
-
isTaxApplicable: "is_tax_applicable",
|
|
111
102
|
});
|
|
112
103
|
});
|
|
113
104
|
|
|
@@ -40,6 +40,10 @@ export type BenefitGitHubRepositoryProperties = {
|
|
|
40
40
|
* The permission level to grant. Read more about roles and their permissions on [GitHub documentation](https://docs.github.com/en/organizations/managing-user-access-to-your-organizations-repositories/managing-repository-roles/repository-roles-for-an-organization#permissions-for-each-role).
|
|
41
41
|
*/
|
|
42
42
|
permission: Permission;
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
|
|
45
|
+
*/
|
|
46
|
+
repositoryId?: string | null | undefined;
|
|
43
47
|
};
|
|
44
48
|
|
|
45
49
|
/** @internal */
|
|
@@ -70,10 +74,12 @@ export const BenefitGitHubRepositoryProperties$inboundSchema: z.ZodType<
|
|
|
70
74
|
repository_owner: z.string(),
|
|
71
75
|
repository_name: z.string(),
|
|
72
76
|
permission: Permission$inboundSchema,
|
|
77
|
+
repository_id: z.nullable(z.string()).optional(),
|
|
73
78
|
}).transform((v) => {
|
|
74
79
|
return remap$(v, {
|
|
75
80
|
"repository_owner": "repositoryOwner",
|
|
76
81
|
"repository_name": "repositoryName",
|
|
82
|
+
"repository_id": "repositoryId",
|
|
77
83
|
});
|
|
78
84
|
});
|
|
79
85
|
|
|
@@ -82,6 +88,7 @@ export type BenefitGitHubRepositoryProperties$Outbound = {
|
|
|
82
88
|
repository_owner: string;
|
|
83
89
|
repository_name: string;
|
|
84
90
|
permission: string;
|
|
91
|
+
repository_id?: string | null | undefined;
|
|
85
92
|
};
|
|
86
93
|
|
|
87
94
|
/** @internal */
|
|
@@ -93,10 +100,12 @@ export const BenefitGitHubRepositoryProperties$outboundSchema: z.ZodType<
|
|
|
93
100
|
repositoryOwner: z.string(),
|
|
94
101
|
repositoryName: z.string(),
|
|
95
102
|
permission: Permission$outboundSchema,
|
|
103
|
+
repositoryId: z.nullable(z.string()).optional(),
|
|
96
104
|
}).transform((v) => {
|
|
97
105
|
return remap$(v, {
|
|
98
106
|
repositoryOwner: "repository_owner",
|
|
99
107
|
repositoryName: "repository_name",
|
|
108
|
+
repositoryId: "repository_id",
|
|
100
109
|
});
|
|
101
110
|
});
|
|
102
111
|
|
|
@@ -76,6 +76,8 @@ export type CheckoutDiscount =
|
|
|
76
76
|
| CheckoutDiscountPercentageRepeatDuration
|
|
77
77
|
| CheckoutDiscountFixedRepeatDuration;
|
|
78
78
|
|
|
79
|
+
export type CustomerMetadata = string | number | boolean;
|
|
80
|
+
|
|
79
81
|
/**
|
|
80
82
|
* Checkout session data retrieved using an access token.
|
|
81
83
|
*/
|
|
@@ -192,6 +194,7 @@ export type Checkout = {
|
|
|
192
194
|
| null;
|
|
193
195
|
subscriptionId: string | null;
|
|
194
196
|
attachedCustomFields: Array<AttachedCustomField>;
|
|
197
|
+
customerMetadata: { [k: string]: string | number | boolean };
|
|
195
198
|
};
|
|
196
199
|
|
|
197
200
|
/** @internal */
|
|
@@ -400,6 +403,54 @@ export function checkoutDiscountFromJSON(
|
|
|
400
403
|
);
|
|
401
404
|
}
|
|
402
405
|
|
|
406
|
+
/** @internal */
|
|
407
|
+
export const CustomerMetadata$inboundSchema: z.ZodType<
|
|
408
|
+
CustomerMetadata,
|
|
409
|
+
z.ZodTypeDef,
|
|
410
|
+
unknown
|
|
411
|
+
> = z.union([z.string(), z.number().int(), z.boolean()]);
|
|
412
|
+
|
|
413
|
+
/** @internal */
|
|
414
|
+
export type CustomerMetadata$Outbound = string | number | boolean;
|
|
415
|
+
|
|
416
|
+
/** @internal */
|
|
417
|
+
export const CustomerMetadata$outboundSchema: z.ZodType<
|
|
418
|
+
CustomerMetadata$Outbound,
|
|
419
|
+
z.ZodTypeDef,
|
|
420
|
+
CustomerMetadata
|
|
421
|
+
> = z.union([z.string(), z.number().int(), z.boolean()]);
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @internal
|
|
425
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
426
|
+
*/
|
|
427
|
+
export namespace CustomerMetadata$ {
|
|
428
|
+
/** @deprecated use `CustomerMetadata$inboundSchema` instead. */
|
|
429
|
+
export const inboundSchema = CustomerMetadata$inboundSchema;
|
|
430
|
+
/** @deprecated use `CustomerMetadata$outboundSchema` instead. */
|
|
431
|
+
export const outboundSchema = CustomerMetadata$outboundSchema;
|
|
432
|
+
/** @deprecated use `CustomerMetadata$Outbound` instead. */
|
|
433
|
+
export type Outbound = CustomerMetadata$Outbound;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
export function customerMetadataToJSON(
|
|
437
|
+
customerMetadata: CustomerMetadata,
|
|
438
|
+
): string {
|
|
439
|
+
return JSON.stringify(
|
|
440
|
+
CustomerMetadata$outboundSchema.parse(customerMetadata),
|
|
441
|
+
);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
export function customerMetadataFromJSON(
|
|
445
|
+
jsonString: string,
|
|
446
|
+
): SafeParseResult<CustomerMetadata, SDKValidationError> {
|
|
447
|
+
return safeParse(
|
|
448
|
+
jsonString,
|
|
449
|
+
(x) => CustomerMetadata$inboundSchema.parse(JSON.parse(x)),
|
|
450
|
+
`Failed to parse 'CustomerMetadata' from JSON`,
|
|
451
|
+
);
|
|
452
|
+
}
|
|
453
|
+
|
|
403
454
|
/** @internal */
|
|
404
455
|
export const Checkout$inboundSchema: z.ZodType<
|
|
405
456
|
Checkout,
|
|
@@ -456,6 +507,9 @@ export const Checkout$inboundSchema: z.ZodType<
|
|
|
456
507
|
),
|
|
457
508
|
subscription_id: z.nullable(z.string()),
|
|
458
509
|
attached_custom_fields: z.array(AttachedCustomField$inboundSchema),
|
|
510
|
+
customer_metadata: z.record(
|
|
511
|
+
z.union([z.string(), z.number().int(), z.boolean()]),
|
|
512
|
+
),
|
|
459
513
|
}).transform((v) => {
|
|
460
514
|
return remap$(v, {
|
|
461
515
|
"created_at": "createdAt",
|
|
@@ -488,6 +542,7 @@ export const Checkout$inboundSchema: z.ZodType<
|
|
|
488
542
|
"product_price": "productPrice",
|
|
489
543
|
"subscription_id": "subscriptionId",
|
|
490
544
|
"attached_custom_fields": "attachedCustomFields",
|
|
545
|
+
"customer_metadata": "customerMetadata",
|
|
491
546
|
});
|
|
492
547
|
});
|
|
493
548
|
|
|
@@ -536,6 +591,7 @@ export type Checkout$Outbound = {
|
|
|
536
591
|
| null;
|
|
537
592
|
subscription_id: string | null;
|
|
538
593
|
attached_custom_fields: Array<AttachedCustomField$Outbound>;
|
|
594
|
+
customer_metadata: { [k: string]: string | number | boolean };
|
|
539
595
|
};
|
|
540
596
|
|
|
541
597
|
/** @internal */
|
|
@@ -592,6 +648,9 @@ export const Checkout$outboundSchema: z.ZodType<
|
|
|
592
648
|
),
|
|
593
649
|
subscriptionId: z.nullable(z.string()),
|
|
594
650
|
attachedCustomFields: z.array(AttachedCustomField$outboundSchema),
|
|
651
|
+
customerMetadata: z.record(
|
|
652
|
+
z.union([z.string(), z.number().int(), z.boolean()]),
|
|
653
|
+
),
|
|
595
654
|
}).transform((v) => {
|
|
596
655
|
return remap$(v, {
|
|
597
656
|
createdAt: "created_at",
|
|
@@ -624,6 +683,7 @@ export const Checkout$outboundSchema: z.ZodType<
|
|
|
624
683
|
productPrice: "product_price",
|
|
625
684
|
subscriptionId: "subscription_id",
|
|
626
685
|
attachedCustomFields: "attached_custom_fields",
|
|
686
|
+
customerMetadata: "customer_metadata",
|
|
627
687
|
});
|
|
628
688
|
});
|
|
629
689
|
|
|
@@ -14,20 +14,6 @@ export type CheckoutLinkUpdateMetadata = string | number | boolean;
|
|
|
14
14
|
* Schema to update an existing checkout link.
|
|
15
15
|
*/
|
|
16
16
|
export type CheckoutLinkUpdate = {
|
|
17
|
-
/**
|
|
18
|
-
* Key-value object allowing you to store additional information.
|
|
19
|
-
*
|
|
20
|
-
* @remarks
|
|
21
|
-
*
|
|
22
|
-
* The key must be a string with a maximum length of **40 characters**.
|
|
23
|
-
* The value must be either:
|
|
24
|
-
*
|
|
25
|
-
* * A string with a maximum length of **500 characters**
|
|
26
|
-
* * An integer
|
|
27
|
-
* * A boolean
|
|
28
|
-
*
|
|
29
|
-
* You can store up to **50 key-value pairs**.
|
|
30
|
-
*/
|
|
31
17
|
metadata?: { [k: string]: string | number | boolean } | null | undefined;
|
|
32
18
|
label?: string | null | undefined;
|
|
33
19
|
/**
|
|
@@ -35,6 +35,8 @@ export type CheckoutPriceCreatePaymentProcessor = ClosedEnum<
|
|
|
35
35
|
typeof CheckoutPriceCreatePaymentProcessor
|
|
36
36
|
>;
|
|
37
37
|
|
|
38
|
+
export type CheckoutPriceCreateCustomerMetadata = string | number | boolean;
|
|
39
|
+
|
|
38
40
|
/**
|
|
39
41
|
* Create a new checkout session from a product price.
|
|
40
42
|
*
|
|
@@ -85,6 +87,21 @@ export type CheckoutPriceCreate = {
|
|
|
85
87
|
customerIpAddress?: string | null | undefined;
|
|
86
88
|
customerBillingAddress?: Address | null | undefined;
|
|
87
89
|
customerTaxId?: string | null | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Key-value object allowing you to store additional information that'll be copied to the created customer.
|
|
92
|
+
*
|
|
93
|
+
* @remarks
|
|
94
|
+
*
|
|
95
|
+
* The key must be a string with a maximum length of **40 characters**.
|
|
96
|
+
* The value must be either:
|
|
97
|
+
*
|
|
98
|
+
* * A string with a maximum length of **500 characters**
|
|
99
|
+
* * An integer
|
|
100
|
+
* * A boolean
|
|
101
|
+
*
|
|
102
|
+
* You can store up to **50 key-value pairs**.
|
|
103
|
+
*/
|
|
104
|
+
customerMetadata?: { [k: string]: string | number | boolean } | undefined;
|
|
88
105
|
/**
|
|
89
106
|
* ID of a subscription to upgrade. It must be on a free pricing. If checkout is successful, metadata set on this checkout will be copied to the subscription, and existing keys will be overwritten.
|
|
90
107
|
*/
|
|
@@ -228,6 +245,62 @@ export namespace CheckoutPriceCreatePaymentProcessor$ {
|
|
|
228
245
|
CheckoutPriceCreatePaymentProcessor$outboundSchema;
|
|
229
246
|
}
|
|
230
247
|
|
|
248
|
+
/** @internal */
|
|
249
|
+
export const CheckoutPriceCreateCustomerMetadata$inboundSchema: z.ZodType<
|
|
250
|
+
CheckoutPriceCreateCustomerMetadata,
|
|
251
|
+
z.ZodTypeDef,
|
|
252
|
+
unknown
|
|
253
|
+
> = z.union([z.string(), z.number().int(), z.boolean()]);
|
|
254
|
+
|
|
255
|
+
/** @internal */
|
|
256
|
+
export type CheckoutPriceCreateCustomerMetadata$Outbound =
|
|
257
|
+
| string
|
|
258
|
+
| number
|
|
259
|
+
| boolean;
|
|
260
|
+
|
|
261
|
+
/** @internal */
|
|
262
|
+
export const CheckoutPriceCreateCustomerMetadata$outboundSchema: z.ZodType<
|
|
263
|
+
CheckoutPriceCreateCustomerMetadata$Outbound,
|
|
264
|
+
z.ZodTypeDef,
|
|
265
|
+
CheckoutPriceCreateCustomerMetadata
|
|
266
|
+
> = z.union([z.string(), z.number().int(), z.boolean()]);
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @internal
|
|
270
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
271
|
+
*/
|
|
272
|
+
export namespace CheckoutPriceCreateCustomerMetadata$ {
|
|
273
|
+
/** @deprecated use `CheckoutPriceCreateCustomerMetadata$inboundSchema` instead. */
|
|
274
|
+
export const inboundSchema =
|
|
275
|
+
CheckoutPriceCreateCustomerMetadata$inboundSchema;
|
|
276
|
+
/** @deprecated use `CheckoutPriceCreateCustomerMetadata$outboundSchema` instead. */
|
|
277
|
+
export const outboundSchema =
|
|
278
|
+
CheckoutPriceCreateCustomerMetadata$outboundSchema;
|
|
279
|
+
/** @deprecated use `CheckoutPriceCreateCustomerMetadata$Outbound` instead. */
|
|
280
|
+
export type Outbound = CheckoutPriceCreateCustomerMetadata$Outbound;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function checkoutPriceCreateCustomerMetadataToJSON(
|
|
284
|
+
checkoutPriceCreateCustomerMetadata: CheckoutPriceCreateCustomerMetadata,
|
|
285
|
+
): string {
|
|
286
|
+
return JSON.stringify(
|
|
287
|
+
CheckoutPriceCreateCustomerMetadata$outboundSchema.parse(
|
|
288
|
+
checkoutPriceCreateCustomerMetadata,
|
|
289
|
+
),
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function checkoutPriceCreateCustomerMetadataFromJSON(
|
|
294
|
+
jsonString: string,
|
|
295
|
+
): SafeParseResult<CheckoutPriceCreateCustomerMetadata, SDKValidationError> {
|
|
296
|
+
return safeParse(
|
|
297
|
+
jsonString,
|
|
298
|
+
(x) =>
|
|
299
|
+
CheckoutPriceCreateCustomerMetadata$inboundSchema.parse(JSON.parse(x)),
|
|
300
|
+
`Failed to parse 'CheckoutPriceCreateCustomerMetadata' from JSON`,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
231
304
|
/** @internal */
|
|
232
305
|
export const CheckoutPriceCreate$inboundSchema: z.ZodType<
|
|
233
306
|
CheckoutPriceCreate,
|
|
@@ -249,6 +322,9 @@ export const CheckoutPriceCreate$inboundSchema: z.ZodType<
|
|
|
249
322
|
customer_ip_address: z.nullable(z.string()).optional(),
|
|
250
323
|
customer_billing_address: z.nullable(Address$inboundSchema).optional(),
|
|
251
324
|
customer_tax_id: z.nullable(z.string()).optional(),
|
|
325
|
+
customer_metadata: z.record(
|
|
326
|
+
z.union([z.string(), z.number().int(), z.boolean()]),
|
|
327
|
+
).optional(),
|
|
252
328
|
subscription_id: z.nullable(z.string()).optional(),
|
|
253
329
|
success_url: z.nullable(z.string()).optional(),
|
|
254
330
|
embed_origin: z.nullable(z.string()).optional(),
|
|
@@ -265,6 +341,7 @@ export const CheckoutPriceCreate$inboundSchema: z.ZodType<
|
|
|
265
341
|
"customer_ip_address": "customerIpAddress",
|
|
266
342
|
"customer_billing_address": "customerBillingAddress",
|
|
267
343
|
"customer_tax_id": "customerTaxId",
|
|
344
|
+
"customer_metadata": "customerMetadata",
|
|
268
345
|
"subscription_id": "subscriptionId",
|
|
269
346
|
"success_url": "successUrl",
|
|
270
347
|
"embed_origin": "embedOrigin",
|
|
@@ -286,6 +363,7 @@ export type CheckoutPriceCreate$Outbound = {
|
|
|
286
363
|
customer_ip_address?: string | null | undefined;
|
|
287
364
|
customer_billing_address?: Address$Outbound | null | undefined;
|
|
288
365
|
customer_tax_id?: string | null | undefined;
|
|
366
|
+
customer_metadata?: { [k: string]: string | number | boolean } | undefined;
|
|
289
367
|
subscription_id?: string | null | undefined;
|
|
290
368
|
success_url?: string | null | undefined;
|
|
291
369
|
embed_origin?: string | null | undefined;
|
|
@@ -313,6 +391,9 @@ export const CheckoutPriceCreate$outboundSchema: z.ZodType<
|
|
|
313
391
|
customerIpAddress: z.nullable(z.string()).optional(),
|
|
314
392
|
customerBillingAddress: z.nullable(Address$outboundSchema).optional(),
|
|
315
393
|
customerTaxId: z.nullable(z.string()).optional(),
|
|
394
|
+
customerMetadata: z.record(
|
|
395
|
+
z.union([z.string(), z.number().int(), z.boolean()]),
|
|
396
|
+
).optional(),
|
|
316
397
|
subscriptionId: z.nullable(z.string()).optional(),
|
|
317
398
|
successUrl: z.nullable(z.string()).optional(),
|
|
318
399
|
embedOrigin: z.nullable(z.string()).optional(),
|
|
@@ -329,6 +410,7 @@ export const CheckoutPriceCreate$outboundSchema: z.ZodType<
|
|
|
329
410
|
customerIpAddress: "customer_ip_address",
|
|
330
411
|
customerBillingAddress: "customer_billing_address",
|
|
331
412
|
customerTaxId: "customer_tax_id",
|
|
413
|
+
customerMetadata: "customer_metadata",
|
|
332
414
|
subscriptionId: "subscription_id",
|
|
333
415
|
successUrl: "success_url",
|
|
334
416
|
embedOrigin: "embed_origin",
|