@polar-sh/sdk 0.22.0 → 0.22.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 +2 -0
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomClientConfirm.js.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomClientUpdate.js.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts +2 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
- package/dist/commonjs/funcs/checkoutsCustomUpdate.js +3 -2
- package/dist/commonjs/funcs/checkoutsCustomUpdate.js.map +1 -1
- package/dist/commonjs/funcs/customerPortalDownloadablesGet.js +1 -1
- package/dist/commonjs/funcs/customerPortalDownloadablesGet.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsGet.d.ts +18 -0
- package/dist/commonjs/funcs/subscriptionsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsGet.js +108 -0
- package/dist/commonjs/funcs/subscriptionsGet.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/models/components/oauth2client.js +2 -2
- package/dist/commonjs/models/components/oauth2client.js.map +1 -1
- package/dist/commonjs/models/components/oauth2clientconfiguration.js +2 -2
- package/dist/commonjs/models/components/oauth2clientconfiguration.js.map +1 -1
- package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/dist/commonjs/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/dist/commonjs/models/components/organization.d.ts +3 -0
- package/dist/commonjs/models/components/organization.d.ts.map +1 -1
- package/dist/commonjs/models/components/organization.js +5 -0
- package/dist/commonjs/models/components/organization.js.map +1 -1
- package/dist/commonjs/models/components/organizationcreate.d.ts +3 -0
- package/dist/commonjs/models/components/organizationcreate.d.ts.map +1 -1
- package/dist/commonjs/models/components/organizationcreate.js +5 -0
- package/dist/commonjs/models/components/organizationcreate.js.map +1 -1
- package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts +34 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.js +77 -0
- package/dist/commonjs/models/components/organizationsubscriptionsettings.js.map +1 -0
- package/dist/commonjs/models/components/organizationupdate.d.ts +3 -0
- package/dist/commonjs/models/components/organizationupdate.d.ts.map +1 -1
- package/dist/commonjs/models/components/organizationupdate.js +5 -0
- package/dist/commonjs/models/components/organizationupdate.js.map +1 -1
- package/dist/commonjs/models/components/scope.d.ts +6 -0
- package/dist/commonjs/models/components/scope.d.ts.map +1 -1
- package/dist/commonjs/models/components/scope.js +2 -0
- package/dist/commonjs/models/components/scope.js.map +1 -1
- package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts +28 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.js +50 -0
- package/dist/commonjs/models/components/subscriptionprorationbehavior.js.map +1 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.d.ts +6 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.d.ts.map +1 -1
- package/dist/commonjs/models/components/subscriptionupdateprice.js +7 -0
- package/dist/commonjs/models/components/subscriptionupdateprice.js.map +1 -1
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js +70 -0
- package/dist/commonjs/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
- package/dist/commonjs/models/operations/subscriptionsget.d.ts +32 -0
- package/dist/commonjs/models/operations/subscriptionsget.d.ts.map +1 -0
- package/dist/commonjs/models/operations/subscriptionsget.js +59 -0
- package/dist/commonjs/models/operations/subscriptionsget.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +8 -0
- package/dist/commonjs/sdk/subscriptions.d.ts.map +1 -1
- package/dist/commonjs/sdk/subscriptions.js +10 -0
- package/dist/commonjs/sdk/subscriptions.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientConfirm.js +3 -2
- package/dist/esm/funcs/checkoutsCustomClientConfirm.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomClientUpdate.js +3 -2
- package/dist/esm/funcs/checkoutsCustomClientUpdate.js.map +1 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.d.ts +2 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.d.ts.map +1 -1
- package/dist/esm/funcs/checkoutsCustomUpdate.js +3 -2
- package/dist/esm/funcs/checkoutsCustomUpdate.js.map +1 -1
- package/dist/esm/funcs/customerPortalDownloadablesGet.js +1 -1
- package/dist/esm/funcs/customerPortalDownloadablesGet.js.map +1 -1
- package/dist/esm/funcs/subscriptionsGet.d.ts +18 -0
- package/dist/esm/funcs/subscriptionsGet.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsGet.js +82 -0
- package/dist/esm/funcs/subscriptionsGet.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/models/components/oauth2client.js +2 -2
- package/dist/esm/models/components/oauth2client.js.map +1 -1
- package/dist/esm/models/components/oauth2clientconfiguration.js +2 -2
- package/dist/esm/models/components/oauth2clientconfiguration.js.map +1 -1
- package/dist/esm/models/components/oauth2clientconfigurationupdate.js +2 -2
- package/dist/esm/models/components/oauth2clientconfigurationupdate.js.map +1 -1
- package/dist/esm/models/components/organization.d.ts +3 -0
- package/dist/esm/models/components/organization.d.ts.map +1 -1
- package/dist/esm/models/components/organization.js +5 -0
- package/dist/esm/models/components/organization.js.map +1 -1
- package/dist/esm/models/components/organizationcreate.d.ts +3 -0
- package/dist/esm/models/components/organizationcreate.d.ts.map +1 -1
- package/dist/esm/models/components/organizationcreate.js +5 -0
- package/dist/esm/models/components/organizationcreate.js.map +1 -1
- package/dist/esm/models/components/organizationsubscriptionsettings.d.ts +34 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.d.ts.map +1 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.js +49 -0
- package/dist/esm/models/components/organizationsubscriptionsettings.js.map +1 -0
- package/dist/esm/models/components/organizationupdate.d.ts +3 -0
- package/dist/esm/models/components/organizationupdate.d.ts.map +1 -1
- package/dist/esm/models/components/organizationupdate.js +5 -0
- package/dist/esm/models/components/organizationupdate.js.map +1 -1
- package/dist/esm/models/components/scope.d.ts +6 -0
- package/dist/esm/models/components/scope.d.ts.map +1 -1
- package/dist/esm/models/components/scope.js +2 -0
- package/dist/esm/models/components/scope.js.map +1 -1
- package/dist/esm/models/components/subscriptionprorationbehavior.d.ts +28 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.d.ts.map +1 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.js +24 -0
- package/dist/esm/models/components/subscriptionprorationbehavior.js.map +1 -0
- package/dist/esm/models/components/subscriptionupdateprice.d.ts +6 -0
- package/dist/esm/models/components/subscriptionupdateprice.d.ts.map +1 -1
- package/dist/esm/models/components/subscriptionupdateprice.js +7 -0
- package/dist/esm/models/components/subscriptionupdateprice.js.map +1 -1
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts +34 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.d.ts.map +1 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.js +43 -0
- package/dist/esm/models/errors/alreadyactivesubscriptionerror.js.map +1 -0
- package/dist/esm/models/operations/subscriptionsget.d.ts +32 -0
- package/dist/esm/models/operations/subscriptionsget.d.ts.map +1 -0
- package/dist/esm/models/operations/subscriptionsget.js +31 -0
- package/dist/esm/models/operations/subscriptionsget.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +8 -0
- package/dist/esm/sdk/subscriptions.d.ts.map +1 -1
- package/dist/esm/sdk/subscriptions.js +10 -0
- package/dist/esm/sdk/subscriptions.js.map +1 -1
- package/docs/sdks/custom/README.md +18 -15
- package/docs/sdks/subscriptions/README.md +79 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/checkoutsCustomClientConfirm.ts +8 -1
- package/src/funcs/checkoutsCustomClientUpdate.ts +8 -1
- package/src/funcs/checkoutsCustomUpdate.ts +8 -1
- package/src/funcs/customerPortalDownloadablesGet.ts +1 -1
- package/src/funcs/subscriptionsGet.ts +157 -0
- package/src/lib/config.ts +3 -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/organization.ts +12 -0
- package/src/models/components/organizationcreate.ts +19 -0
- package/src/models/components/organizationsubscriptionsettings.ts +94 -0
- package/src/models/components/organizationupdate.ts +19 -0
- package/src/models/components/scope.ts +2 -0
- package/src/models/components/subscriptionprorationbehavior.ts +35 -0
- package/src/models/components/subscriptionupdateprice.ts +16 -0
- package/src/models/errors/alreadyactivesubscriptionerror.ts +77 -0
- package/src/models/operations/subscriptionsget.ts +69 -0
- package/src/sdk/subscriptions.ts +19 -0
|
@@ -14,6 +14,10 @@ import {
|
|
|
14
14
|
Checkout,
|
|
15
15
|
Checkout$inboundSchema,
|
|
16
16
|
} from "../models/components/checkout.js";
|
|
17
|
+
import {
|
|
18
|
+
AlreadyActiveSubscriptionError,
|
|
19
|
+
AlreadyActiveSubscriptionError$inboundSchema,
|
|
20
|
+
} from "../models/errors/alreadyactivesubscriptionerror.js";
|
|
17
21
|
import {
|
|
18
22
|
ConnectionError,
|
|
19
23
|
InvalidRequestError,
|
|
@@ -50,6 +54,7 @@ export async function checkoutsCustomUpdate(
|
|
|
50
54
|
): Promise<
|
|
51
55
|
Result<
|
|
52
56
|
Checkout,
|
|
57
|
+
| AlreadyActiveSubscriptionError
|
|
53
58
|
| ResourceNotFound
|
|
54
59
|
| HTTPValidationError
|
|
55
60
|
| SDKError
|
|
@@ -119,7 +124,7 @@ export async function checkoutsCustomUpdate(
|
|
|
119
124
|
|
|
120
125
|
const doResult = await client._do(req, {
|
|
121
126
|
context,
|
|
122
|
-
errorCodes: ["404", "422", "4XX", "5XX"],
|
|
127
|
+
errorCodes: ["403", "404", "422", "4XX", "5XX"],
|
|
123
128
|
retryConfig: context.retryConfig,
|
|
124
129
|
retryCodes: context.retryCodes,
|
|
125
130
|
});
|
|
@@ -134,6 +139,7 @@ export async function checkoutsCustomUpdate(
|
|
|
134
139
|
|
|
135
140
|
const [result] = await M.match<
|
|
136
141
|
Checkout,
|
|
142
|
+
| AlreadyActiveSubscriptionError
|
|
137
143
|
| ResourceNotFound
|
|
138
144
|
| HTTPValidationError
|
|
139
145
|
| SDKError
|
|
@@ -145,6 +151,7 @@ export async function checkoutsCustomUpdate(
|
|
|
145
151
|
| ConnectionError
|
|
146
152
|
>(
|
|
147
153
|
M.json(200, Checkout$inboundSchema),
|
|
154
|
+
M.jsonErr(403, AlreadyActiveSubscriptionError$inboundSchema),
|
|
148
155
|
M.jsonErr(404, ResourceNotFound$inboundSchema),
|
|
149
156
|
M.jsonErr(422, HTTPValidationError$inboundSchema),
|
|
150
157
|
M.fail("4XX"),
|
|
@@ -138,8 +138,8 @@ export async function customerPortalDownloadablesGet(
|
|
|
138
138
|
>(
|
|
139
139
|
M.json(200, z.any().optional()),
|
|
140
140
|
M.nil(302, z.any().optional()),
|
|
141
|
-
M.fail([400, 404, 410, "4XX"]),
|
|
142
141
|
M.jsonErr(422, HTTPValidationError$inboundSchema),
|
|
142
|
+
M.fail([400, 404, 410, "4XX"]),
|
|
143
143
|
M.fail("5XX"),
|
|
144
144
|
)(response, { extraFields: responseFields });
|
|
145
145
|
if (!result.ok) {
|
|
@@ -0,0 +1,157 @@
|
|
|
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 { compactMap } from "../lib/primitives.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
|
+
Subscription,
|
|
15
|
+
Subscription$inboundSchema,
|
|
16
|
+
} from "../models/components/subscription.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import {
|
|
25
|
+
HTTPValidationError,
|
|
26
|
+
HTTPValidationError$inboundSchema,
|
|
27
|
+
} from "../models/errors/httpvalidationerror.js";
|
|
28
|
+
import {
|
|
29
|
+
ResourceNotFound,
|
|
30
|
+
ResourceNotFound$inboundSchema,
|
|
31
|
+
} from "../models/errors/resourcenotfound.js";
|
|
32
|
+
import { SDKError } from "../models/errors/sdkerror.js";
|
|
33
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
34
|
+
import {
|
|
35
|
+
SubscriptionsGetRequest,
|
|
36
|
+
SubscriptionsGetRequest$outboundSchema,
|
|
37
|
+
} from "../models/operations/subscriptionsget.js";
|
|
38
|
+
import { Result } from "../types/fp.js";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Get Subscription
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Get a subscription by ID.
|
|
45
|
+
*/
|
|
46
|
+
export async function subscriptionsGet(
|
|
47
|
+
client: PolarCore,
|
|
48
|
+
request: SubscriptionsGetRequest,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): Promise<
|
|
51
|
+
Result<
|
|
52
|
+
Subscription,
|
|
53
|
+
| ResourceNotFound
|
|
54
|
+
| HTTPValidationError
|
|
55
|
+
| SDKError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
| UnexpectedClientError
|
|
58
|
+
| InvalidRequestError
|
|
59
|
+
| RequestAbortedError
|
|
60
|
+
| RequestTimeoutError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
>
|
|
63
|
+
> {
|
|
64
|
+
const parsed = safeParse(
|
|
65
|
+
request,
|
|
66
|
+
(value) => SubscriptionsGetRequest$outboundSchema.parse(value),
|
|
67
|
+
"Input validation failed",
|
|
68
|
+
);
|
|
69
|
+
if (!parsed.ok) {
|
|
70
|
+
return parsed;
|
|
71
|
+
}
|
|
72
|
+
const payload = parsed.value;
|
|
73
|
+
const body = null;
|
|
74
|
+
|
|
75
|
+
const pathParams = {
|
|
76
|
+
id: encodeSimple("id", payload.id, {
|
|
77
|
+
explode: false,
|
|
78
|
+
charEncoding: "percent",
|
|
79
|
+
}),
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const path = pathToFunc("/v1/subscriptions/{id}")(pathParams);
|
|
83
|
+
|
|
84
|
+
const headers = new Headers(compactMap({
|
|
85
|
+
Accept: "application/json",
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
const secConfig = await extractSecurity(client._options.accessToken);
|
|
89
|
+
const securityInput = secConfig == null ? {} : { accessToken: secConfig };
|
|
90
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
91
|
+
|
|
92
|
+
const context = {
|
|
93
|
+
operationID: "subscriptions:get",
|
|
94
|
+
oAuth2Scopes: [],
|
|
95
|
+
|
|
96
|
+
resolvedSecurity: requestSecurity,
|
|
97
|
+
|
|
98
|
+
securitySource: client._options.accessToken,
|
|
99
|
+
retryConfig: options?.retries
|
|
100
|
+
|| client._options.retryConfig
|
|
101
|
+
|| { strategy: "none" },
|
|
102
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const requestRes = client._createRequest(context, {
|
|
106
|
+
security: requestSecurity,
|
|
107
|
+
method: "GET",
|
|
108
|
+
baseURL: options?.serverURL,
|
|
109
|
+
path: path,
|
|
110
|
+
headers: headers,
|
|
111
|
+
body: body,
|
|
112
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
113
|
+
}, options);
|
|
114
|
+
if (!requestRes.ok) {
|
|
115
|
+
return requestRes;
|
|
116
|
+
}
|
|
117
|
+
const req = requestRes.value;
|
|
118
|
+
|
|
119
|
+
const doResult = await client._do(req, {
|
|
120
|
+
context,
|
|
121
|
+
errorCodes: ["404", "422", "4XX", "5XX"],
|
|
122
|
+
retryConfig: context.retryConfig,
|
|
123
|
+
retryCodes: context.retryCodes,
|
|
124
|
+
});
|
|
125
|
+
if (!doResult.ok) {
|
|
126
|
+
return doResult;
|
|
127
|
+
}
|
|
128
|
+
const response = doResult.value;
|
|
129
|
+
|
|
130
|
+
const responseFields = {
|
|
131
|
+
HttpMeta: { Response: response, Request: req },
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const [result] = await M.match<
|
|
135
|
+
Subscription,
|
|
136
|
+
| ResourceNotFound
|
|
137
|
+
| HTTPValidationError
|
|
138
|
+
| SDKError
|
|
139
|
+
| SDKValidationError
|
|
140
|
+
| UnexpectedClientError
|
|
141
|
+
| InvalidRequestError
|
|
142
|
+
| RequestAbortedError
|
|
143
|
+
| RequestTimeoutError
|
|
144
|
+
| ConnectionError
|
|
145
|
+
>(
|
|
146
|
+
M.json(200, Subscription$inboundSchema),
|
|
147
|
+
M.jsonErr(404, ResourceNotFound$inboundSchema),
|
|
148
|
+
M.jsonErr(422, HTTPValidationError$inboundSchema),
|
|
149
|
+
M.fail("4XX"),
|
|
150
|
+
M.fail("5XX"),
|
|
151
|
+
)(response, { extraFields: responseFields });
|
|
152
|
+
if (!result.ok) {
|
|
153
|
+
return result;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return result;
|
|
157
|
+
}
|
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.22.
|
|
64
|
-
genVersion: "2.
|
|
65
|
-
userAgent: "speakeasy-sdk/typescript 0.22.
|
|
63
|
+
sdkVersion: "0.22.2",
|
|
64
|
+
genVersion: "2.497.8",
|
|
65
|
+
userAgent: "speakeasy-sdk/typescript 0.22.2 2.497.8 0.1.0 @polar-sh/sdk",
|
|
66
66
|
} as const;
|
|
@@ -102,7 +102,7 @@ export const OAuth2Client$inboundSchema: z.ZodType<
|
|
|
102
102
|
grant_types: z.array(GrantTypes$inboundSchema).optional(),
|
|
103
103
|
response_types: z.array(z.string()).optional(),
|
|
104
104
|
scope: z.string().default(
|
|
105
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
105
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
106
106
|
),
|
|
107
107
|
client_name: z.string(),
|
|
108
108
|
client_uri: z.nullable(z.string()).optional(),
|
|
@@ -170,7 +170,7 @@ export const OAuth2Client$outboundSchema: z.ZodType<
|
|
|
170
170
|
grantTypes: z.array(GrantTypes$outboundSchema).optional(),
|
|
171
171
|
responseTypes: z.array(z.string()).optional(),
|
|
172
172
|
scope: z.string().default(
|
|
173
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
173
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
174
174
|
),
|
|
175
175
|
clientName: z.string(),
|
|
176
176
|
clientUri: z.nullable(z.string()).optional(),
|
|
@@ -102,7 +102,7 @@ export const OAuth2ClientConfiguration$inboundSchema: z.ZodType<
|
|
|
102
102
|
.optional(),
|
|
103
103
|
response_types: z.array(z.string()).optional(),
|
|
104
104
|
scope: z.string().default(
|
|
105
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
105
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
106
106
|
),
|
|
107
107
|
client_name: z.string(),
|
|
108
108
|
client_uri: z.nullable(z.string()).optional(),
|
|
@@ -152,7 +152,7 @@ export const OAuth2ClientConfiguration$outboundSchema: z.ZodType<
|
|
|
152
152
|
.optional(),
|
|
153
153
|
responseTypes: z.array(z.string()).optional(),
|
|
154
154
|
scope: z.string().default(
|
|
155
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
155
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
156
156
|
),
|
|
157
157
|
clientName: z.string(),
|
|
158
158
|
clientUri: z.nullable(z.string()).optional(),
|
|
@@ -104,7 +104,7 @@ export const OAuth2ClientConfigurationUpdate$inboundSchema: z.ZodType<
|
|
|
104
104
|
.optional(),
|
|
105
105
|
response_types: z.array(z.string()).optional(),
|
|
106
106
|
scope: z.string().default(
|
|
107
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
107
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
108
108
|
),
|
|
109
109
|
client_name: z.string(),
|
|
110
110
|
client_uri: z.nullable(z.string()).optional(),
|
|
@@ -156,7 +156,7 @@ export const OAuth2ClientConfigurationUpdate$outboundSchema: z.ZodType<
|
|
|
156
156
|
.optional(),
|
|
157
157
|
responseTypes: z.array(z.string()).optional(),
|
|
158
158
|
scope: z.string().default(
|
|
159
|
-
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
159
|
+
"openid profile email user:read organizations:read organizations:write custom_fields:read custom_fields:write discounts:read discounts:write checkout_links:read checkout_links:write checkouts:read checkouts:write products:read products:write benefits:read benefits:write events:read events:write files:read files:write subscriptions:read subscriptions:write customers:read customers:write customer_sessions:write orders:read refunds:read refunds:write metrics:read webhooks:read webhooks:write external_organizations:read license_keys:read license_keys:write repositories:read repositories:write issues:read issues:write customer_portal:read customer_portal:write",
|
|
160
160
|
),
|
|
161
161
|
clientName: z.string(),
|
|
162
162
|
clientUri: z.nullable(z.string()).optional(),
|
|
@@ -19,6 +19,12 @@ import {
|
|
|
19
19
|
OrganizationProfileSettings$Outbound,
|
|
20
20
|
OrganizationProfileSettings$outboundSchema,
|
|
21
21
|
} from "./organizationprofilesettings.js";
|
|
22
|
+
import {
|
|
23
|
+
OrganizationSubscriptionSettings,
|
|
24
|
+
OrganizationSubscriptionSettings$inboundSchema,
|
|
25
|
+
OrganizationSubscriptionSettings$Outbound,
|
|
26
|
+
OrganizationSubscriptionSettings$outboundSchema,
|
|
27
|
+
} from "./organizationsubscriptionsettings.js";
|
|
22
28
|
|
|
23
29
|
export type Organization = {
|
|
24
30
|
/**
|
|
@@ -53,6 +59,7 @@ export type Organization = {
|
|
|
53
59
|
* Settings for the organization features
|
|
54
60
|
*/
|
|
55
61
|
featureSettings: OrganizationFeatureSettings | null;
|
|
62
|
+
subscriptionSettings: OrganizationSubscriptionSettings;
|
|
56
63
|
};
|
|
57
64
|
|
|
58
65
|
/** @internal */
|
|
@@ -80,6 +87,7 @@ export const Organization$inboundSchema: z.ZodType<
|
|
|
80
87
|
default_upfront_split_to_contributors: z.nullable(z.number().int()),
|
|
81
88
|
profile_settings: z.nullable(OrganizationProfileSettings$inboundSchema),
|
|
82
89
|
feature_settings: z.nullable(OrganizationFeatureSettings$inboundSchema),
|
|
90
|
+
subscription_settings: OrganizationSubscriptionSettings$inboundSchema,
|
|
83
91
|
}).transform((v) => {
|
|
84
92
|
return remap$(v, {
|
|
85
93
|
"created_at": "createdAt",
|
|
@@ -92,6 +100,7 @@ export const Organization$inboundSchema: z.ZodType<
|
|
|
92
100
|
"defaultUpfrontSplitToContributors",
|
|
93
101
|
"profile_settings": "profileSettings",
|
|
94
102
|
"feature_settings": "featureSettings",
|
|
103
|
+
"subscription_settings": "subscriptionSettings",
|
|
95
104
|
});
|
|
96
105
|
});
|
|
97
106
|
|
|
@@ -114,6 +123,7 @@ export type Organization$Outbound = {
|
|
|
114
123
|
default_upfront_split_to_contributors: number | null;
|
|
115
124
|
profile_settings: OrganizationProfileSettings$Outbound | null;
|
|
116
125
|
feature_settings: OrganizationFeatureSettings$Outbound | null;
|
|
126
|
+
subscription_settings: OrganizationSubscriptionSettings$Outbound;
|
|
117
127
|
};
|
|
118
128
|
|
|
119
129
|
/** @internal */
|
|
@@ -139,6 +149,7 @@ export const Organization$outboundSchema: z.ZodType<
|
|
|
139
149
|
defaultUpfrontSplitToContributors: z.nullable(z.number().int()),
|
|
140
150
|
profileSettings: z.nullable(OrganizationProfileSettings$outboundSchema),
|
|
141
151
|
featureSettings: z.nullable(OrganizationFeatureSettings$outboundSchema),
|
|
152
|
+
subscriptionSettings: OrganizationSubscriptionSettings$outboundSchema,
|
|
142
153
|
}).transform((v) => {
|
|
143
154
|
return remap$(v, {
|
|
144
155
|
createdAt: "created_at",
|
|
@@ -150,6 +161,7 @@ export const Organization$outboundSchema: z.ZodType<
|
|
|
150
161
|
defaultUpfrontSplitToContributors: "default_upfront_split_to_contributors",
|
|
151
162
|
profileSettings: "profile_settings",
|
|
152
163
|
featureSettings: "feature_settings",
|
|
164
|
+
subscriptionSettings: "subscription_settings",
|
|
153
165
|
});
|
|
154
166
|
});
|
|
155
167
|
|
|
@@ -13,12 +13,19 @@ import {
|
|
|
13
13
|
OrganizationFeatureSettings$Outbound,
|
|
14
14
|
OrganizationFeatureSettings$outboundSchema,
|
|
15
15
|
} from "./organizationfeaturesettings.js";
|
|
16
|
+
import {
|
|
17
|
+
OrganizationSubscriptionSettings,
|
|
18
|
+
OrganizationSubscriptionSettings$inboundSchema,
|
|
19
|
+
OrganizationSubscriptionSettings$Outbound,
|
|
20
|
+
OrganizationSubscriptionSettings$outboundSchema,
|
|
21
|
+
} from "./organizationsubscriptionsettings.js";
|
|
16
22
|
|
|
17
23
|
export type OrganizationCreate = {
|
|
18
24
|
name: string;
|
|
19
25
|
slug: string;
|
|
20
26
|
avatarUrl?: string | null | undefined;
|
|
21
27
|
featureSettings?: OrganizationFeatureSettings | null | undefined;
|
|
28
|
+
subscriptionSettings?: OrganizationSubscriptionSettings | null | undefined;
|
|
22
29
|
};
|
|
23
30
|
|
|
24
31
|
/** @internal */
|
|
@@ -32,10 +39,14 @@ export const OrganizationCreate$inboundSchema: z.ZodType<
|
|
|
32
39
|
avatar_url: z.nullable(z.string()).optional(),
|
|
33
40
|
feature_settings: z.nullable(OrganizationFeatureSettings$inboundSchema)
|
|
34
41
|
.optional(),
|
|
42
|
+
subscription_settings: z.nullable(
|
|
43
|
+
OrganizationSubscriptionSettings$inboundSchema,
|
|
44
|
+
).optional(),
|
|
35
45
|
}).transform((v) => {
|
|
36
46
|
return remap$(v, {
|
|
37
47
|
"avatar_url": "avatarUrl",
|
|
38
48
|
"feature_settings": "featureSettings",
|
|
49
|
+
"subscription_settings": "subscriptionSettings",
|
|
39
50
|
});
|
|
40
51
|
});
|
|
41
52
|
|
|
@@ -45,6 +56,10 @@ export type OrganizationCreate$Outbound = {
|
|
|
45
56
|
slug: string;
|
|
46
57
|
avatar_url?: string | null | undefined;
|
|
47
58
|
feature_settings?: OrganizationFeatureSettings$Outbound | null | undefined;
|
|
59
|
+
subscription_settings?:
|
|
60
|
+
| OrganizationSubscriptionSettings$Outbound
|
|
61
|
+
| null
|
|
62
|
+
| undefined;
|
|
48
63
|
};
|
|
49
64
|
|
|
50
65
|
/** @internal */
|
|
@@ -58,10 +73,14 @@ export const OrganizationCreate$outboundSchema: z.ZodType<
|
|
|
58
73
|
avatarUrl: z.nullable(z.string()).optional(),
|
|
59
74
|
featureSettings: z.nullable(OrganizationFeatureSettings$outboundSchema)
|
|
60
75
|
.optional(),
|
|
76
|
+
subscriptionSettings: z.nullable(
|
|
77
|
+
OrganizationSubscriptionSettings$outboundSchema,
|
|
78
|
+
).optional(),
|
|
61
79
|
}).transform((v) => {
|
|
62
80
|
return remap$(v, {
|
|
63
81
|
avatarUrl: "avatar_url",
|
|
64
82
|
featureSettings: "feature_settings",
|
|
83
|
+
subscriptionSettings: "subscription_settings",
|
|
65
84
|
});
|
|
66
85
|
});
|
|
67
86
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
SubscriptionProrationBehavior,
|
|
12
|
+
SubscriptionProrationBehavior$inboundSchema,
|
|
13
|
+
SubscriptionProrationBehavior$outboundSchema,
|
|
14
|
+
} from "./subscriptionprorationbehavior.js";
|
|
15
|
+
|
|
16
|
+
export type OrganizationSubscriptionSettings = {
|
|
17
|
+
allowMultipleSubscriptions: boolean;
|
|
18
|
+
allowCustomerUpdates: boolean;
|
|
19
|
+
prorationBehavior: SubscriptionProrationBehavior;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const OrganizationSubscriptionSettings$inboundSchema: z.ZodType<
|
|
24
|
+
OrganizationSubscriptionSettings,
|
|
25
|
+
z.ZodTypeDef,
|
|
26
|
+
unknown
|
|
27
|
+
> = z.object({
|
|
28
|
+
allow_multiple_subscriptions: z.boolean(),
|
|
29
|
+
allow_customer_updates: z.boolean(),
|
|
30
|
+
proration_behavior: SubscriptionProrationBehavior$inboundSchema,
|
|
31
|
+
}).transform((v) => {
|
|
32
|
+
return remap$(v, {
|
|
33
|
+
"allow_multiple_subscriptions": "allowMultipleSubscriptions",
|
|
34
|
+
"allow_customer_updates": "allowCustomerUpdates",
|
|
35
|
+
"proration_behavior": "prorationBehavior",
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/** @internal */
|
|
40
|
+
export type OrganizationSubscriptionSettings$Outbound = {
|
|
41
|
+
allow_multiple_subscriptions: boolean;
|
|
42
|
+
allow_customer_updates: boolean;
|
|
43
|
+
proration_behavior: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @internal */
|
|
47
|
+
export const OrganizationSubscriptionSettings$outboundSchema: z.ZodType<
|
|
48
|
+
OrganizationSubscriptionSettings$Outbound,
|
|
49
|
+
z.ZodTypeDef,
|
|
50
|
+
OrganizationSubscriptionSettings
|
|
51
|
+
> = z.object({
|
|
52
|
+
allowMultipleSubscriptions: z.boolean(),
|
|
53
|
+
allowCustomerUpdates: z.boolean(),
|
|
54
|
+
prorationBehavior: SubscriptionProrationBehavior$outboundSchema,
|
|
55
|
+
}).transform((v) => {
|
|
56
|
+
return remap$(v, {
|
|
57
|
+
allowMultipleSubscriptions: "allow_multiple_subscriptions",
|
|
58
|
+
allowCustomerUpdates: "allow_customer_updates",
|
|
59
|
+
prorationBehavior: "proration_behavior",
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
66
|
+
*/
|
|
67
|
+
export namespace OrganizationSubscriptionSettings$ {
|
|
68
|
+
/** @deprecated use `OrganizationSubscriptionSettings$inboundSchema` instead. */
|
|
69
|
+
export const inboundSchema = OrganizationSubscriptionSettings$inboundSchema;
|
|
70
|
+
/** @deprecated use `OrganizationSubscriptionSettings$outboundSchema` instead. */
|
|
71
|
+
export const outboundSchema = OrganizationSubscriptionSettings$outboundSchema;
|
|
72
|
+
/** @deprecated use `OrganizationSubscriptionSettings$Outbound` instead. */
|
|
73
|
+
export type Outbound = OrganizationSubscriptionSettings$Outbound;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function organizationSubscriptionSettingsToJSON(
|
|
77
|
+
organizationSubscriptionSettings: OrganizationSubscriptionSettings,
|
|
78
|
+
): string {
|
|
79
|
+
return JSON.stringify(
|
|
80
|
+
OrganizationSubscriptionSettings$outboundSchema.parse(
|
|
81
|
+
organizationSubscriptionSettings,
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function organizationSubscriptionSettingsFromJSON(
|
|
87
|
+
jsonString: string,
|
|
88
|
+
): SafeParseResult<OrganizationSubscriptionSettings, SDKValidationError> {
|
|
89
|
+
return safeParse(
|
|
90
|
+
jsonString,
|
|
91
|
+
(x) => OrganizationSubscriptionSettings$inboundSchema.parse(JSON.parse(x)),
|
|
92
|
+
`Failed to parse 'OrganizationSubscriptionSettings' from JSON`,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -19,6 +19,12 @@ import {
|
|
|
19
19
|
OrganizationProfileSettings$Outbound,
|
|
20
20
|
OrganizationProfileSettings$outboundSchema,
|
|
21
21
|
} from "./organizationprofilesettings.js";
|
|
22
|
+
import {
|
|
23
|
+
OrganizationSubscriptionSettings,
|
|
24
|
+
OrganizationSubscriptionSettings$inboundSchema,
|
|
25
|
+
OrganizationSubscriptionSettings$Outbound,
|
|
26
|
+
OrganizationSubscriptionSettings$outboundSchema,
|
|
27
|
+
} from "./organizationsubscriptionsettings.js";
|
|
22
28
|
|
|
23
29
|
export type OrganizationUpdate = {
|
|
24
30
|
name?: string | null | undefined;
|
|
@@ -32,6 +38,7 @@ export type OrganizationUpdate = {
|
|
|
32
38
|
perUserMonthlySpendingLimit?: number | null | undefined;
|
|
33
39
|
profileSettings?: OrganizationProfileSettings | null | undefined;
|
|
34
40
|
featureSettings?: OrganizationFeatureSettings | null | undefined;
|
|
41
|
+
subscriptionSettings?: OrganizationSubscriptionSettings | null | undefined;
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
/** @internal */
|
|
@@ -54,6 +61,9 @@ export const OrganizationUpdate$inboundSchema: z.ZodType<
|
|
|
54
61
|
.optional(),
|
|
55
62
|
feature_settings: z.nullable(OrganizationFeatureSettings$inboundSchema)
|
|
56
63
|
.optional(),
|
|
64
|
+
subscription_settings: z.nullable(
|
|
65
|
+
OrganizationSubscriptionSettings$inboundSchema,
|
|
66
|
+
).optional(),
|
|
57
67
|
}).transform((v) => {
|
|
58
68
|
return remap$(v, {
|
|
59
69
|
"avatar_url": "avatarUrl",
|
|
@@ -67,6 +77,7 @@ export const OrganizationUpdate$inboundSchema: z.ZodType<
|
|
|
67
77
|
"per_user_monthly_spending_limit": "perUserMonthlySpendingLimit",
|
|
68
78
|
"profile_settings": "profileSettings",
|
|
69
79
|
"feature_settings": "featureSettings",
|
|
80
|
+
"subscription_settings": "subscriptionSettings",
|
|
70
81
|
});
|
|
71
82
|
});
|
|
72
83
|
|
|
@@ -83,6 +94,10 @@ export type OrganizationUpdate$Outbound = {
|
|
|
83
94
|
per_user_monthly_spending_limit?: number | null | undefined;
|
|
84
95
|
profile_settings?: OrganizationProfileSettings$Outbound | null | undefined;
|
|
85
96
|
feature_settings?: OrganizationFeatureSettings$Outbound | null | undefined;
|
|
97
|
+
subscription_settings?:
|
|
98
|
+
| OrganizationSubscriptionSettings$Outbound
|
|
99
|
+
| null
|
|
100
|
+
| undefined;
|
|
86
101
|
};
|
|
87
102
|
|
|
88
103
|
/** @internal */
|
|
@@ -104,6 +119,9 @@ export const OrganizationUpdate$outboundSchema: z.ZodType<
|
|
|
104
119
|
.optional(),
|
|
105
120
|
featureSettings: z.nullable(OrganizationFeatureSettings$outboundSchema)
|
|
106
121
|
.optional(),
|
|
122
|
+
subscriptionSettings: z.nullable(
|
|
123
|
+
OrganizationSubscriptionSettings$outboundSchema,
|
|
124
|
+
).optional(),
|
|
107
125
|
}).transform((v) => {
|
|
108
126
|
return remap$(v, {
|
|
109
127
|
avatarUrl: "avatar_url",
|
|
@@ -116,6 +134,7 @@ export const OrganizationUpdate$outboundSchema: z.ZodType<
|
|
|
116
134
|
perUserMonthlySpendingLimit: "per_user_monthly_spending_limit",
|
|
117
135
|
profileSettings: "profile_settings",
|
|
118
136
|
featureSettings: "feature_settings",
|
|
137
|
+
subscriptionSettings: "subscription_settings",
|
|
119
138
|
});
|
|
120
139
|
});
|
|
121
140
|
|
|
@@ -26,6 +26,8 @@ export const Scope = {
|
|
|
26
26
|
ProductsWrite: "products:write",
|
|
27
27
|
BenefitsRead: "benefits:read",
|
|
28
28
|
BenefitsWrite: "benefits:write",
|
|
29
|
+
EventsRead: "events:read",
|
|
30
|
+
EventsWrite: "events:write",
|
|
29
31
|
FilesRead: "files:read",
|
|
30
32
|
FilesWrite: "files:write",
|
|
31
33
|
SubscriptionsRead: "subscriptions:read",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const SubscriptionProrationBehavior = {
|
|
9
|
+
Invoice: "invoice",
|
|
10
|
+
Prorate: "prorate",
|
|
11
|
+
} as const;
|
|
12
|
+
export type SubscriptionProrationBehavior = ClosedEnum<
|
|
13
|
+
typeof SubscriptionProrationBehavior
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export const SubscriptionProrationBehavior$inboundSchema: z.ZodNativeEnum<
|
|
18
|
+
typeof SubscriptionProrationBehavior
|
|
19
|
+
> = z.nativeEnum(SubscriptionProrationBehavior);
|
|
20
|
+
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const SubscriptionProrationBehavior$outboundSchema: z.ZodNativeEnum<
|
|
23
|
+
typeof SubscriptionProrationBehavior
|
|
24
|
+
> = SubscriptionProrationBehavior$inboundSchema;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @internal
|
|
28
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
29
|
+
*/
|
|
30
|
+
export namespace SubscriptionProrationBehavior$ {
|
|
31
|
+
/** @deprecated use `SubscriptionProrationBehavior$inboundSchema` instead. */
|
|
32
|
+
export const inboundSchema = SubscriptionProrationBehavior$inboundSchema;
|
|
33
|
+
/** @deprecated use `SubscriptionProrationBehavior$outboundSchema` instead. */
|
|
34
|
+
export const outboundSchema = SubscriptionProrationBehavior$outboundSchema;
|
|
35
|
+
}
|
|
@@ -7,12 +7,21 @@ import { remap as remap$ } from "../../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
8
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
9
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
SubscriptionProrationBehavior,
|
|
12
|
+
SubscriptionProrationBehavior$inboundSchema,
|
|
13
|
+
SubscriptionProrationBehavior$outboundSchema,
|
|
14
|
+
} from "./subscriptionprorationbehavior.js";
|
|
10
15
|
|
|
11
16
|
export type SubscriptionUpdatePrice = {
|
|
12
17
|
/**
|
|
13
18
|
* Update subscription to another price.
|
|
14
19
|
*/
|
|
15
20
|
productPriceId: string;
|
|
21
|
+
/**
|
|
22
|
+
* Determine how to handle the proration billing. If not provided, will use the default organization setting.
|
|
23
|
+
*/
|
|
24
|
+
prorationBehavior?: SubscriptionProrationBehavior | null | undefined;
|
|
16
25
|
};
|
|
17
26
|
|
|
18
27
|
/** @internal */
|
|
@@ -22,15 +31,19 @@ export const SubscriptionUpdatePrice$inboundSchema: z.ZodType<
|
|
|
22
31
|
unknown
|
|
23
32
|
> = z.object({
|
|
24
33
|
product_price_id: z.string(),
|
|
34
|
+
proration_behavior: z.nullable(SubscriptionProrationBehavior$inboundSchema)
|
|
35
|
+
.optional(),
|
|
25
36
|
}).transform((v) => {
|
|
26
37
|
return remap$(v, {
|
|
27
38
|
"product_price_id": "productPriceId",
|
|
39
|
+
"proration_behavior": "prorationBehavior",
|
|
28
40
|
});
|
|
29
41
|
});
|
|
30
42
|
|
|
31
43
|
/** @internal */
|
|
32
44
|
export type SubscriptionUpdatePrice$Outbound = {
|
|
33
45
|
product_price_id: string;
|
|
46
|
+
proration_behavior?: string | null | undefined;
|
|
34
47
|
};
|
|
35
48
|
|
|
36
49
|
/** @internal */
|
|
@@ -40,9 +53,12 @@ export const SubscriptionUpdatePrice$outboundSchema: z.ZodType<
|
|
|
40
53
|
SubscriptionUpdatePrice
|
|
41
54
|
> = z.object({
|
|
42
55
|
productPriceId: z.string(),
|
|
56
|
+
prorationBehavior: z.nullable(SubscriptionProrationBehavior$outboundSchema)
|
|
57
|
+
.optional(),
|
|
43
58
|
}).transform((v) => {
|
|
44
59
|
return remap$(v, {
|
|
45
60
|
productPriceId: "product_price_id",
|
|
61
|
+
prorationBehavior: "proration_behavior",
|
|
46
62
|
});
|
|
47
63
|
});
|
|
48
64
|
|