@flexprice/sdk 2.1.5 → 2.1.6
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/docs/sdk/models/create-price-request.md +1 -1
- package/docs/sdk/models/create-subscription-request.md +1 -2
- package/docs/sdk/models/invoice-billing-reason.md +1 -1
- package/docs/sdk/models/price-price.md +42 -42
- package/docs/sdk/models/price-response.md +47 -47
- package/docs/sdk/models/subscription-filter.md +1 -0
- package/docs/sdk/models/subscription-line-item-response.md +0 -1
- package/docs/sdk/models/subscription-price-create-request.md +1 -1
- package/docs/sdk/models/subscription-subscription-line-item.md +0 -1
- package/docs/sdk/models/window-size.md +2 -2
- package/docs/sdks/subscriptions/README.md +0 -226
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/sdk/models/create-price-request.d.ts +2 -2
- package/esm/sdk/models/create-price-request.d.ts.map +1 -1
- package/esm/sdk/models/create-price-request.js +2 -2
- package/esm/sdk/models/create-price-request.js.map +1 -1
- package/esm/sdk/models/create-subscription-request.d.ts +8 -4
- package/esm/sdk/models/create-subscription-request.d.ts.map +1 -1
- package/esm/sdk/models/create-subscription-request.js +2 -4
- package/esm/sdk/models/create-subscription-request.js.map +1 -1
- package/esm/sdk/models/index.d.ts +0 -7
- package/esm/sdk/models/index.d.ts.map +1 -1
- package/esm/sdk/models/index.js +0 -7
- package/esm/sdk/models/index.js.map +1 -1
- package/esm/sdk/models/invoice-billing-reason.d.ts +1 -0
- package/esm/sdk/models/invoice-billing-reason.d.ts.map +1 -1
- package/esm/sdk/models/invoice-billing-reason.js +1 -0
- package/esm/sdk/models/invoice-billing-reason.js.map +1 -1
- package/esm/sdk/models/pause-mode.d.ts +0 -2
- package/esm/sdk/models/pause-mode.d.ts.map +1 -1
- package/esm/sdk/models/pause-mode.js +0 -2
- package/esm/sdk/models/pause-mode.js.map +1 -1
- package/esm/sdk/models/price-price.d.ts +2 -2
- package/esm/sdk/models/price-price.d.ts.map +1 -1
- package/esm/sdk/models/price-price.js +2 -2
- package/esm/sdk/models/price-price.js.map +1 -1
- package/esm/sdk/models/price-response.d.ts +2 -2
- package/esm/sdk/models/price-response.d.ts.map +1 -1
- package/esm/sdk/models/price-response.js +2 -2
- package/esm/sdk/models/price-response.js.map +1 -1
- package/esm/sdk/models/resume-mode.d.ts +0 -2
- package/esm/sdk/models/resume-mode.d.ts.map +1 -1
- package/esm/sdk/models/resume-mode.js +0 -2
- package/esm/sdk/models/resume-mode.js.map +1 -1
- package/esm/sdk/models/subscription-filter.d.ts +8 -0
- package/esm/sdk/models/subscription-filter.d.ts.map +1 -1
- package/esm/sdk/models/subscription-filter.js +2 -0
- package/esm/sdk/models/subscription-filter.js.map +1 -1
- package/esm/sdk/models/subscription-line-item-response.d.ts +0 -1
- package/esm/sdk/models/subscription-line-item-response.d.ts.map +1 -1
- package/esm/sdk/models/subscription-line-item-response.js +0 -2
- package/esm/sdk/models/subscription-line-item-response.js.map +1 -1
- package/esm/sdk/models/subscription-price-create-request.d.ts +2 -2
- package/esm/sdk/models/subscription-price-create-request.d.ts.map +1 -1
- package/esm/sdk/models/subscription-price-create-request.js +2 -2
- package/esm/sdk/models/subscription-price-create-request.js.map +1 -1
- package/esm/sdk/models/subscription-subscription-line-item.d.ts +0 -1
- package/esm/sdk/models/subscription-subscription-line-item.d.ts.map +1 -1
- package/esm/sdk/models/subscription-subscription-line-item.js +0 -2
- package/esm/sdk/models/subscription-subscription-line-item.js.map +1 -1
- package/esm/sdk/models/window-size.d.ts +1 -1
- package/esm/sdk/models/window-size.js +1 -1
- package/esm/sdk/models/window-size.js.map +1 -1
- package/esm/sdk/subscriptions.d.ts +0 -21
- package/esm/sdk/subscriptions.d.ts.map +1 -1
- package/esm/sdk/subscriptions.js +0 -30
- package/esm/sdk/subscriptions.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +2 -2
- package/src/sdk/models/create-price-request.ts +4 -4
- package/src/sdk/models/create-subscription-request.ts +10 -8
- package/src/sdk/models/index.ts +0 -7
- package/src/sdk/models/invoice-billing-reason.ts +1 -0
- package/src/sdk/models/pause-mode.ts +0 -3
- package/src/sdk/models/price-price.ts +4 -4
- package/src/sdk/models/price-response.ts +4 -4
- package/src/sdk/models/resume-mode.ts +0 -3
- package/src/sdk/models/subscription-filter.ts +12 -0
- package/src/sdk/models/subscription-line-item-response.ts +0 -3
- package/src/sdk/models/subscription-price-create-request.ts +4 -4
- package/src/sdk/models/subscription-subscription-line-item.ts +0 -3
- package/src/sdk/models/window-size.ts +1 -1
- package/src/sdk/subscriptions.ts +0 -58
- package/docs/sdk/models/list-subscription-pauses-request.md +0 -17
- package/docs/sdk/models/list-subscription-pauses-response.md +0 -18
- package/docs/sdk/models/pause-subscription-request-request.md +0 -21
- package/docs/sdk/models/pause-subscription-request.md +0 -25
- package/docs/sdk/models/resume-subscription-request-request.md +0 -21
- package/docs/sdk/models/resume-subscription-request.md +0 -21
- package/docs/sdk/models/subscription-pause-response.md +0 -35
- package/esm/funcs/subscriptions-list-subscription-pauses.d.ts +0 -17
- package/esm/funcs/subscriptions-list-subscription-pauses.d.ts.map +0 -1
- package/esm/funcs/subscriptions-list-subscription-pauses.js +0 -91
- package/esm/funcs/subscriptions-list-subscription-pauses.js.map +0 -1
- package/esm/funcs/subscriptions-pause-subscription.d.ts +0 -17
- package/esm/funcs/subscriptions-pause-subscription.d.ts.map +0 -1
- package/esm/funcs/subscriptions-pause-subscription.js +0 -93
- package/esm/funcs/subscriptions-pause-subscription.js.map +0 -1
- package/esm/funcs/subscriptions-resume-subscription.d.ts +0 -17
- package/esm/funcs/subscriptions-resume-subscription.d.ts.map +0 -1
- package/esm/funcs/subscriptions-resume-subscription.js +0 -93
- package/esm/funcs/subscriptions-resume-subscription.js.map +0 -1
- package/esm/sdk/models/list-subscription-pauses-op.d.ts +0 -15
- package/esm/sdk/models/list-subscription-pauses-op.d.ts.map +0 -1
- package/esm/sdk/models/list-subscription-pauses-op.js +0 -12
- package/esm/sdk/models/list-subscription-pauses-op.js.map +0 -1
- package/esm/sdk/models/list-subscription-pauses-response.d.ts +0 -27
- package/esm/sdk/models/list-subscription-pauses-response.d.ts.map +0 -1
- package/esm/sdk/models/list-subscription-pauses-response.js +0 -16
- package/esm/sdk/models/list-subscription-pauses-response.js.map +0 -1
- package/esm/sdk/models/pause-subscription-op.d.ts +0 -21
- package/esm/sdk/models/pause-subscription-op.d.ts.map +0 -1
- package/esm/sdk/models/pause-subscription-op.js +0 -14
- package/esm/sdk/models/pause-subscription-op.js.map +0 -1
- package/esm/sdk/models/pause-subscription-request.d.ts +0 -74
- package/esm/sdk/models/pause-subscription-request.d.ts.map +0 -1
- package/esm/sdk/models/pause-subscription-request.js +0 -28
- package/esm/sdk/models/pause-subscription-request.js.map +0 -1
- package/esm/sdk/models/resume-subscription-op.d.ts +0 -21
- package/esm/sdk/models/resume-subscription-op.d.ts.map +0 -1
- package/esm/sdk/models/resume-subscription-op.js +0 -14
- package/esm/sdk/models/resume-subscription-op.js.map +0 -1
- package/esm/sdk/models/resume-subscription-request.d.ts +0 -38
- package/esm/sdk/models/resume-subscription-request.d.ts.map +0 -1
- package/esm/sdk/models/resume-subscription-request.js +0 -21
- package/esm/sdk/models/resume-subscription-request.js.map +0 -1
- package/esm/sdk/models/subscription-pause-response.d.ts +0 -64
- package/esm/sdk/models/subscription-pause-response.d.ts.map +0 -1
- package/esm/sdk/models/subscription-pause-response.js +0 -55
- package/esm/sdk/models/subscription-pause-response.js.map +0 -1
- package/src/funcs/subscriptions-list-subscription-pauses.ts +0 -182
- package/src/funcs/subscriptions-pause-subscription.ts +0 -187
- package/src/funcs/subscriptions-resume-subscription.ts +0 -187
- package/src/sdk/models/list-subscription-pauses-op.ts +0 -35
- package/src/sdk/models/list-subscription-pauses-response.ts +0 -52
- package/src/sdk/models/pause-subscription-op.ts +0 -46
- package/src/sdk/models/pause-subscription-request.ts +0 -106
- package/src/sdk/models/resume-subscription-op.ts +0 -46
- package/src/sdk/models/resume-subscription-request.ts +0 -63
- package/src/sdk/models/subscription-pause-response.ts +0 -123
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { FlexpriceCore } from "../core.js";
|
|
7
|
-
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
8
|
-
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
-
import * as M from "../lib/matchers.js";
|
|
10
|
-
import { compactMap } from "../lib/primitives.js";
|
|
11
|
-
import { safeParse } from "../lib/schemas.js";
|
|
12
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
-
import { pathToFunc } from "../lib/url.js";
|
|
15
|
-
import { FlexPriceError } from "../sdk/models/flex-price-error.js";
|
|
16
|
-
import {
|
|
17
|
-
ConnectionError,
|
|
18
|
-
InvalidRequestError,
|
|
19
|
-
RequestAbortedError,
|
|
20
|
-
RequestTimeoutError,
|
|
21
|
-
UnexpectedClientError,
|
|
22
|
-
} from "../sdk/models/http-client-errors.js";
|
|
23
|
-
import * as models from "../sdk/models/index.js";
|
|
24
|
-
import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
|
|
25
|
-
import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
|
|
26
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
-
import { Result } from "../types/fp.js";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Pause a subscription
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Use when temporarily stopping a subscription (e.g. customer hold or seasonal pause). Billing and access pause; resume when ready.
|
|
34
|
-
*/
|
|
35
|
-
export function subscriptionsPauseSubscription(
|
|
36
|
-
client: FlexpriceCore,
|
|
37
|
-
id: string,
|
|
38
|
-
body: models.PauseSubscriptionRequest,
|
|
39
|
-
options?: RequestOptions,
|
|
40
|
-
): APIPromise<
|
|
41
|
-
Result<
|
|
42
|
-
models.SubscriptionPauseResponse,
|
|
43
|
-
| models.ErrorsErrorResponse
|
|
44
|
-
| FlexPriceError
|
|
45
|
-
| ResponseValidationError
|
|
46
|
-
| ConnectionError
|
|
47
|
-
| RequestAbortedError
|
|
48
|
-
| RequestTimeoutError
|
|
49
|
-
| InvalidRequestError
|
|
50
|
-
| UnexpectedClientError
|
|
51
|
-
| SDKValidationError
|
|
52
|
-
>
|
|
53
|
-
> {
|
|
54
|
-
return new APIPromise($do(
|
|
55
|
-
client,
|
|
56
|
-
id,
|
|
57
|
-
body,
|
|
58
|
-
options,
|
|
59
|
-
));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function $do(
|
|
63
|
-
client: FlexpriceCore,
|
|
64
|
-
id: string,
|
|
65
|
-
body: models.PauseSubscriptionRequest,
|
|
66
|
-
options?: RequestOptions,
|
|
67
|
-
): Promise<
|
|
68
|
-
[
|
|
69
|
-
Result<
|
|
70
|
-
models.SubscriptionPauseResponse,
|
|
71
|
-
| models.ErrorsErrorResponse
|
|
72
|
-
| FlexPriceError
|
|
73
|
-
| ResponseValidationError
|
|
74
|
-
| ConnectionError
|
|
75
|
-
| RequestAbortedError
|
|
76
|
-
| RequestTimeoutError
|
|
77
|
-
| InvalidRequestError
|
|
78
|
-
| UnexpectedClientError
|
|
79
|
-
| SDKValidationError
|
|
80
|
-
>,
|
|
81
|
-
APICall,
|
|
82
|
-
]
|
|
83
|
-
> {
|
|
84
|
-
const input: models.PauseSubscriptionRequestRequest = {
|
|
85
|
-
id: id,
|
|
86
|
-
body: body,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const parsed = safeParse(
|
|
90
|
-
input,
|
|
91
|
-
(value) =>
|
|
92
|
-
z.parse(models.PauseSubscriptionRequestRequest$outboundSchema, value),
|
|
93
|
-
"Input validation failed",
|
|
94
|
-
);
|
|
95
|
-
if (!parsed.ok) {
|
|
96
|
-
return [parsed, { status: "invalid" }];
|
|
97
|
-
}
|
|
98
|
-
const payload = parsed.value;
|
|
99
|
-
const body$ = encodeJSON("body", payload.body, { explode: true });
|
|
100
|
-
|
|
101
|
-
const pathParams = {
|
|
102
|
-
id: encodeSimple("id", payload.id, {
|
|
103
|
-
explode: false,
|
|
104
|
-
charEncoding: "percent",
|
|
105
|
-
}),
|
|
106
|
-
};
|
|
107
|
-
const path = pathToFunc("/subscriptions/{id}/pause")(pathParams);
|
|
108
|
-
|
|
109
|
-
const headers = new Headers(compactMap({
|
|
110
|
-
"Content-Type": "application/json",
|
|
111
|
-
Accept: "application/json",
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
115
|
-
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
116
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
117
|
-
|
|
118
|
-
const context = {
|
|
119
|
-
options: client._options,
|
|
120
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
121
|
-
operationID: "pauseSubscription",
|
|
122
|
-
oAuth2Scopes: null,
|
|
123
|
-
|
|
124
|
-
resolvedSecurity: requestSecurity,
|
|
125
|
-
|
|
126
|
-
securitySource: client._options.apiKeyAuth,
|
|
127
|
-
retryConfig: options?.retries
|
|
128
|
-
|| client._options.retryConfig
|
|
129
|
-
|| { strategy: "none" },
|
|
130
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const requestRes = client._createRequest(context, {
|
|
134
|
-
security: requestSecurity,
|
|
135
|
-
method: "POST",
|
|
136
|
-
baseURL: options?.serverURL,
|
|
137
|
-
path: path,
|
|
138
|
-
headers: headers,
|
|
139
|
-
body: body$,
|
|
140
|
-
userAgent: client._options.userAgent,
|
|
141
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
142
|
-
}, options);
|
|
143
|
-
if (!requestRes.ok) {
|
|
144
|
-
return [requestRes, { status: "invalid" }];
|
|
145
|
-
}
|
|
146
|
-
const req = requestRes.value;
|
|
147
|
-
|
|
148
|
-
const doResult = await client._do(req, {
|
|
149
|
-
context,
|
|
150
|
-
isErrorStatusCode: (statusCode: number) =>
|
|
151
|
-
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
152
|
-
retryConfig: context.retryConfig,
|
|
153
|
-
retryCodes: context.retryCodes,
|
|
154
|
-
});
|
|
155
|
-
if (!doResult.ok) {
|
|
156
|
-
return [doResult, { status: "request-error", request: req }];
|
|
157
|
-
}
|
|
158
|
-
const response = doResult.value;
|
|
159
|
-
|
|
160
|
-
const responseFields = {
|
|
161
|
-
HttpMeta: { Response: response, Request: req },
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const [result] = await M.match<
|
|
165
|
-
models.SubscriptionPauseResponse,
|
|
166
|
-
| models.ErrorsErrorResponse
|
|
167
|
-
| FlexPriceError
|
|
168
|
-
| ResponseValidationError
|
|
169
|
-
| ConnectionError
|
|
170
|
-
| RequestAbortedError
|
|
171
|
-
| RequestTimeoutError
|
|
172
|
-
| InvalidRequestError
|
|
173
|
-
| UnexpectedClientError
|
|
174
|
-
| SDKValidationError
|
|
175
|
-
>(
|
|
176
|
-
M.json(200, models.SubscriptionPauseResponse$inboundSchema),
|
|
177
|
-
M.jsonErr([400, 404], models.ErrorsErrorResponse$inboundSchema),
|
|
178
|
-
M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
|
|
179
|
-
M.fail("4XX"),
|
|
180
|
-
M.fail("5XX"),
|
|
181
|
-
)(response, req, { extraFields: responseFields });
|
|
182
|
-
if (!result.ok) {
|
|
183
|
-
return [result, { status: "complete", request: req, response }];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return [result, { status: "complete", request: req, response }];
|
|
187
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { FlexpriceCore } from "../core.js";
|
|
7
|
-
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
8
|
-
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
-
import * as M from "../lib/matchers.js";
|
|
10
|
-
import { compactMap } from "../lib/primitives.js";
|
|
11
|
-
import { safeParse } from "../lib/schemas.js";
|
|
12
|
-
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
-
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
-
import { pathToFunc } from "../lib/url.js";
|
|
15
|
-
import { FlexPriceError } from "../sdk/models/flex-price-error.js";
|
|
16
|
-
import {
|
|
17
|
-
ConnectionError,
|
|
18
|
-
InvalidRequestError,
|
|
19
|
-
RequestAbortedError,
|
|
20
|
-
RequestTimeoutError,
|
|
21
|
-
UnexpectedClientError,
|
|
22
|
-
} from "../sdk/models/http-client-errors.js";
|
|
23
|
-
import * as models from "../sdk/models/index.js";
|
|
24
|
-
import { ResponseValidationError } from "../sdk/models/response-validation-error.js";
|
|
25
|
-
import { SDKValidationError } from "../sdk/models/sdk-validation-error.js";
|
|
26
|
-
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
-
import { Result } from "../types/fp.js";
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Resume a paused subscription
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* Use when reactivating a paused subscription (e.g. end of hold). Billing and access resume from the resume date.
|
|
34
|
-
*/
|
|
35
|
-
export function subscriptionsResumeSubscription(
|
|
36
|
-
client: FlexpriceCore,
|
|
37
|
-
id: string,
|
|
38
|
-
body: models.ResumeSubscriptionRequest,
|
|
39
|
-
options?: RequestOptions,
|
|
40
|
-
): APIPromise<
|
|
41
|
-
Result<
|
|
42
|
-
models.SubscriptionPauseResponse,
|
|
43
|
-
| models.ErrorsErrorResponse
|
|
44
|
-
| FlexPriceError
|
|
45
|
-
| ResponseValidationError
|
|
46
|
-
| ConnectionError
|
|
47
|
-
| RequestAbortedError
|
|
48
|
-
| RequestTimeoutError
|
|
49
|
-
| InvalidRequestError
|
|
50
|
-
| UnexpectedClientError
|
|
51
|
-
| SDKValidationError
|
|
52
|
-
>
|
|
53
|
-
> {
|
|
54
|
-
return new APIPromise($do(
|
|
55
|
-
client,
|
|
56
|
-
id,
|
|
57
|
-
body,
|
|
58
|
-
options,
|
|
59
|
-
));
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function $do(
|
|
63
|
-
client: FlexpriceCore,
|
|
64
|
-
id: string,
|
|
65
|
-
body: models.ResumeSubscriptionRequest,
|
|
66
|
-
options?: RequestOptions,
|
|
67
|
-
): Promise<
|
|
68
|
-
[
|
|
69
|
-
Result<
|
|
70
|
-
models.SubscriptionPauseResponse,
|
|
71
|
-
| models.ErrorsErrorResponse
|
|
72
|
-
| FlexPriceError
|
|
73
|
-
| ResponseValidationError
|
|
74
|
-
| ConnectionError
|
|
75
|
-
| RequestAbortedError
|
|
76
|
-
| RequestTimeoutError
|
|
77
|
-
| InvalidRequestError
|
|
78
|
-
| UnexpectedClientError
|
|
79
|
-
| SDKValidationError
|
|
80
|
-
>,
|
|
81
|
-
APICall,
|
|
82
|
-
]
|
|
83
|
-
> {
|
|
84
|
-
const input: models.ResumeSubscriptionRequestRequest = {
|
|
85
|
-
id: id,
|
|
86
|
-
body: body,
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const parsed = safeParse(
|
|
90
|
-
input,
|
|
91
|
-
(value) =>
|
|
92
|
-
z.parse(models.ResumeSubscriptionRequestRequest$outboundSchema, value),
|
|
93
|
-
"Input validation failed",
|
|
94
|
-
);
|
|
95
|
-
if (!parsed.ok) {
|
|
96
|
-
return [parsed, { status: "invalid" }];
|
|
97
|
-
}
|
|
98
|
-
const payload = parsed.value;
|
|
99
|
-
const body$ = encodeJSON("body", payload.body, { explode: true });
|
|
100
|
-
|
|
101
|
-
const pathParams = {
|
|
102
|
-
id: encodeSimple("id", payload.id, {
|
|
103
|
-
explode: false,
|
|
104
|
-
charEncoding: "percent",
|
|
105
|
-
}),
|
|
106
|
-
};
|
|
107
|
-
const path = pathToFunc("/subscriptions/{id}/resume")(pathParams);
|
|
108
|
-
|
|
109
|
-
const headers = new Headers(compactMap({
|
|
110
|
-
"Content-Type": "application/json",
|
|
111
|
-
Accept: "application/json",
|
|
112
|
-
}));
|
|
113
|
-
|
|
114
|
-
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
115
|
-
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
116
|
-
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
117
|
-
|
|
118
|
-
const context = {
|
|
119
|
-
options: client._options,
|
|
120
|
-
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
121
|
-
operationID: "resumeSubscription",
|
|
122
|
-
oAuth2Scopes: null,
|
|
123
|
-
|
|
124
|
-
resolvedSecurity: requestSecurity,
|
|
125
|
-
|
|
126
|
-
securitySource: client._options.apiKeyAuth,
|
|
127
|
-
retryConfig: options?.retries
|
|
128
|
-
|| client._options.retryConfig
|
|
129
|
-
|| { strategy: "none" },
|
|
130
|
-
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const requestRes = client._createRequest(context, {
|
|
134
|
-
security: requestSecurity,
|
|
135
|
-
method: "POST",
|
|
136
|
-
baseURL: options?.serverURL,
|
|
137
|
-
path: path,
|
|
138
|
-
headers: headers,
|
|
139
|
-
body: body$,
|
|
140
|
-
userAgent: client._options.userAgent,
|
|
141
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
142
|
-
}, options);
|
|
143
|
-
if (!requestRes.ok) {
|
|
144
|
-
return [requestRes, { status: "invalid" }];
|
|
145
|
-
}
|
|
146
|
-
const req = requestRes.value;
|
|
147
|
-
|
|
148
|
-
const doResult = await client._do(req, {
|
|
149
|
-
context,
|
|
150
|
-
isErrorStatusCode: (statusCode: number) =>
|
|
151
|
-
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
152
|
-
retryConfig: context.retryConfig,
|
|
153
|
-
retryCodes: context.retryCodes,
|
|
154
|
-
});
|
|
155
|
-
if (!doResult.ok) {
|
|
156
|
-
return [doResult, { status: "request-error", request: req }];
|
|
157
|
-
}
|
|
158
|
-
const response = doResult.value;
|
|
159
|
-
|
|
160
|
-
const responseFields = {
|
|
161
|
-
HttpMeta: { Response: response, Request: req },
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const [result] = await M.match<
|
|
165
|
-
models.SubscriptionPauseResponse,
|
|
166
|
-
| models.ErrorsErrorResponse
|
|
167
|
-
| FlexPriceError
|
|
168
|
-
| ResponseValidationError
|
|
169
|
-
| ConnectionError
|
|
170
|
-
| RequestAbortedError
|
|
171
|
-
| RequestTimeoutError
|
|
172
|
-
| InvalidRequestError
|
|
173
|
-
| UnexpectedClientError
|
|
174
|
-
| SDKValidationError
|
|
175
|
-
>(
|
|
176
|
-
M.json(200, models.SubscriptionPauseResponse$inboundSchema),
|
|
177
|
-
M.jsonErr([400, 404], models.ErrorsErrorResponse$inboundSchema),
|
|
178
|
-
M.jsonErr(500, models.ErrorsErrorResponse$inboundSchema),
|
|
179
|
-
M.fail("4XX"),
|
|
180
|
-
M.fail("5XX"),
|
|
181
|
-
)(response, req, { extraFields: responseFields });
|
|
182
|
-
if (!result.ok) {
|
|
183
|
-
return [result, { status: "complete", request: req, response }];
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return [result, { status: "complete", request: req, response }];
|
|
187
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
|
|
7
|
-
export type ListSubscriptionPausesRequest = {
|
|
8
|
-
/**
|
|
9
|
-
* Subscription ID
|
|
10
|
-
*/
|
|
11
|
-
id: string;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/** @internal */
|
|
15
|
-
export type ListSubscriptionPausesRequest$Outbound = {
|
|
16
|
-
id: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/** @internal */
|
|
20
|
-
export const ListSubscriptionPausesRequest$outboundSchema: z.ZodMiniType<
|
|
21
|
-
ListSubscriptionPausesRequest$Outbound,
|
|
22
|
-
ListSubscriptionPausesRequest
|
|
23
|
-
> = z.object({
|
|
24
|
-
id: z.string(),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export function listSubscriptionPausesRequestToJSON(
|
|
28
|
-
listSubscriptionPausesRequest: ListSubscriptionPausesRequest,
|
|
29
|
-
): string {
|
|
30
|
-
return JSON.stringify(
|
|
31
|
-
ListSubscriptionPausesRequest$outboundSchema.parse(
|
|
32
|
-
listSubscriptionPausesRequest,
|
|
33
|
-
),
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
-
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
-
import * as types from "../../types/primitives.js";
|
|
9
|
-
import { SDKValidationError } from "./sdk-validation-error.js";
|
|
10
|
-
import {
|
|
11
|
-
SubscriptionPauseResponse,
|
|
12
|
-
SubscriptionPauseResponse$inboundSchema,
|
|
13
|
-
} from "./subscription-pause-response.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Response object for listing subscription pauses with total count
|
|
17
|
-
*/
|
|
18
|
-
export type ListSubscriptionPausesResponse = {
|
|
19
|
-
/**
|
|
20
|
-
* List of subscription pause objects
|
|
21
|
-
*
|
|
22
|
-
* @remarks
|
|
23
|
-
* @Description Array of subscription pauses
|
|
24
|
-
*/
|
|
25
|
-
items?: Array<SubscriptionPauseResponse> | undefined;
|
|
26
|
-
/**
|
|
27
|
-
* Total number of pauses
|
|
28
|
-
*
|
|
29
|
-
* @remarks
|
|
30
|
-
* @Description Total count of subscription pauses in the response
|
|
31
|
-
*/
|
|
32
|
-
total?: number | undefined;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
/** @internal */
|
|
36
|
-
export const ListSubscriptionPausesResponse$inboundSchema: z.ZodMiniType<
|
|
37
|
-
ListSubscriptionPausesResponse,
|
|
38
|
-
unknown
|
|
39
|
-
> = z.object({
|
|
40
|
-
items: types.optional(z.array(SubscriptionPauseResponse$inboundSchema)),
|
|
41
|
-
total: types.optional(types.number()),
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export function listSubscriptionPausesResponseFromJSON(
|
|
45
|
-
jsonString: string,
|
|
46
|
-
): SafeParseResult<ListSubscriptionPausesResponse, SDKValidationError> {
|
|
47
|
-
return safeParse(
|
|
48
|
-
jsonString,
|
|
49
|
-
(x) => ListSubscriptionPausesResponse$inboundSchema.parse(JSON.parse(x)),
|
|
50
|
-
`Failed to parse 'ListSubscriptionPausesResponse' from JSON`,
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import {
|
|
7
|
-
PauseSubscriptionRequest,
|
|
8
|
-
PauseSubscriptionRequest$Outbound,
|
|
9
|
-
PauseSubscriptionRequest$outboundSchema,
|
|
10
|
-
} from "./pause-subscription-request.js";
|
|
11
|
-
|
|
12
|
-
export type PauseSubscriptionRequestRequest = {
|
|
13
|
-
/**
|
|
14
|
-
* Subscription ID
|
|
15
|
-
*/
|
|
16
|
-
id: string;
|
|
17
|
-
/**
|
|
18
|
-
* Pause subscription request
|
|
19
|
-
*/
|
|
20
|
-
body: PauseSubscriptionRequest;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** @internal */
|
|
24
|
-
export type PauseSubscriptionRequestRequest$Outbound = {
|
|
25
|
-
id: string;
|
|
26
|
-
body: PauseSubscriptionRequest$Outbound;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** @internal */
|
|
30
|
-
export const PauseSubscriptionRequestRequest$outboundSchema: z.ZodMiniType<
|
|
31
|
-
PauseSubscriptionRequestRequest$Outbound,
|
|
32
|
-
PauseSubscriptionRequestRequest
|
|
33
|
-
> = z.object({
|
|
34
|
-
id: z.string(),
|
|
35
|
-
body: PauseSubscriptionRequest$outboundSchema,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export function pauseSubscriptionRequestRequestToJSON(
|
|
39
|
-
pauseSubscriptionRequestRequest: PauseSubscriptionRequestRequest,
|
|
40
|
-
): string {
|
|
41
|
-
return JSON.stringify(
|
|
42
|
-
PauseSubscriptionRequestRequest$outboundSchema.parse(
|
|
43
|
-
pauseSubscriptionRequestRequest,
|
|
44
|
-
),
|
|
45
|
-
);
|
|
46
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
-
import { PauseMode, PauseMode$outboundSchema } from "./pause-mode.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Request object for pausing an active subscription with various pause modes and options
|
|
11
|
-
*/
|
|
12
|
-
export type PauseSubscriptionRequest = {
|
|
13
|
-
/**
|
|
14
|
-
* Whether to perform a dry run
|
|
15
|
-
*
|
|
16
|
-
* @remarks
|
|
17
|
-
* @Description If true, validates the request and shows impact without actually pausing the subscription
|
|
18
|
-
* @Example false
|
|
19
|
-
*/
|
|
20
|
-
dryRun?: boolean | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Additional metadata as key-value pairs
|
|
23
|
-
*
|
|
24
|
-
* @remarks
|
|
25
|
-
* @Description Optional metadata for storing additional information about the pause
|
|
26
|
-
* @Example {"requested_by": "customer", "channel": "support_ticket"}
|
|
27
|
-
*/
|
|
28
|
-
metadata?: { [k: string]: string } | undefined;
|
|
29
|
-
/**
|
|
30
|
-
* Duration of the pause in days
|
|
31
|
-
*
|
|
32
|
-
* @remarks
|
|
33
|
-
* @Description Number of days to pause the subscription. Cannot be used together with pause_end. Must be greater than 0
|
|
34
|
-
* @Example 30
|
|
35
|
-
*/
|
|
36
|
-
pauseDays?: number | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* End date for the subscription pause
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* @Description ISO 8601 timestamp when the pause should end. Cannot be used together with pause_days. Must be after pause_start
|
|
42
|
-
* @Example "2024-02-15T00:00:00Z"
|
|
43
|
-
*/
|
|
44
|
-
pauseEnd?: Date | undefined;
|
|
45
|
-
pauseMode: PauseMode;
|
|
46
|
-
/**
|
|
47
|
-
* Start date for the subscription pause
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* @Description ISO 8601 timestamp when the pause should begin. Required when pause_mode is "scheduled"
|
|
51
|
-
* @Example "2024-01-15T00:00:00Z"
|
|
52
|
-
*/
|
|
53
|
-
pauseStart?: Date | undefined;
|
|
54
|
-
/**
|
|
55
|
-
* Reason for pausing the subscription
|
|
56
|
-
*
|
|
57
|
-
* @remarks
|
|
58
|
-
* @Description Optional reason for the pause. Maximum 255 characters
|
|
59
|
-
* @Example "Customer requested temporary suspension"
|
|
60
|
-
*/
|
|
61
|
-
reason?: string | undefined;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
/** @internal */
|
|
65
|
-
export type PauseSubscriptionRequest$Outbound = {
|
|
66
|
-
dry_run?: boolean | undefined;
|
|
67
|
-
metadata?: { [k: string]: string } | undefined;
|
|
68
|
-
pause_days?: number | undefined;
|
|
69
|
-
pause_end?: string | undefined;
|
|
70
|
-
pause_mode: string;
|
|
71
|
-
pause_start?: string | undefined;
|
|
72
|
-
reason?: string | undefined;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
/** @internal */
|
|
76
|
-
export const PauseSubscriptionRequest$outboundSchema: z.ZodMiniType<
|
|
77
|
-
PauseSubscriptionRequest$Outbound,
|
|
78
|
-
PauseSubscriptionRequest
|
|
79
|
-
> = z.pipe(
|
|
80
|
-
z.object({
|
|
81
|
-
dryRun: z.optional(z.boolean()),
|
|
82
|
-
metadata: z.optional(z.record(z.string(), z.string())),
|
|
83
|
-
pauseDays: z.optional(z.int()),
|
|
84
|
-
pauseEnd: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
85
|
-
pauseMode: PauseMode$outboundSchema,
|
|
86
|
-
pauseStart: z.optional(z.pipe(z.date(), z.transform(v => v.toISOString()))),
|
|
87
|
-
reason: z.optional(z.string()),
|
|
88
|
-
}),
|
|
89
|
-
z.transform((v) => {
|
|
90
|
-
return remap$(v, {
|
|
91
|
-
dryRun: "dry_run",
|
|
92
|
-
pauseDays: "pause_days",
|
|
93
|
-
pauseEnd: "pause_end",
|
|
94
|
-
pauseMode: "pause_mode",
|
|
95
|
-
pauseStart: "pause_start",
|
|
96
|
-
});
|
|
97
|
-
}),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
export function pauseSubscriptionRequestToJSON(
|
|
101
|
-
pauseSubscriptionRequest: PauseSubscriptionRequest,
|
|
102
|
-
): string {
|
|
103
|
-
return JSON.stringify(
|
|
104
|
-
PauseSubscriptionRequest$outboundSchema.parse(pauseSubscriptionRequest),
|
|
105
|
-
);
|
|
106
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import * as z from "zod/v4-mini";
|
|
6
|
-
import {
|
|
7
|
-
ResumeSubscriptionRequest,
|
|
8
|
-
ResumeSubscriptionRequest$Outbound,
|
|
9
|
-
ResumeSubscriptionRequest$outboundSchema,
|
|
10
|
-
} from "./resume-subscription-request.js";
|
|
11
|
-
|
|
12
|
-
export type ResumeSubscriptionRequestRequest = {
|
|
13
|
-
/**
|
|
14
|
-
* Subscription ID
|
|
15
|
-
*/
|
|
16
|
-
id: string;
|
|
17
|
-
/**
|
|
18
|
-
* Resume subscription request
|
|
19
|
-
*/
|
|
20
|
-
body: ResumeSubscriptionRequest;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/** @internal */
|
|
24
|
-
export type ResumeSubscriptionRequestRequest$Outbound = {
|
|
25
|
-
id: string;
|
|
26
|
-
body: ResumeSubscriptionRequest$Outbound;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** @internal */
|
|
30
|
-
export const ResumeSubscriptionRequestRequest$outboundSchema: z.ZodMiniType<
|
|
31
|
-
ResumeSubscriptionRequestRequest$Outbound,
|
|
32
|
-
ResumeSubscriptionRequestRequest
|
|
33
|
-
> = z.object({
|
|
34
|
-
id: z.string(),
|
|
35
|
-
body: ResumeSubscriptionRequest$outboundSchema,
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export function resumeSubscriptionRequestRequestToJSON(
|
|
39
|
-
resumeSubscriptionRequestRequest: ResumeSubscriptionRequestRequest,
|
|
40
|
-
): string {
|
|
41
|
-
return JSON.stringify(
|
|
42
|
-
ResumeSubscriptionRequestRequest$outboundSchema.parse(
|
|
43
|
-
resumeSubscriptionRequestRequest,
|
|
44
|
-
),
|
|
45
|
-
);
|
|
46
|
-
}
|