@paygentic/sdk 0.7.20 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/commonjs/funcs/pricesCreate.js +2 -2
- package/dist/commonjs/funcs/pricesCreate.js.map +1 -1
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js +125 -0
- package/dist/commonjs/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +8 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +8 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/invoice.d.ts +4 -4
- package/dist/commonjs/models/invoice.d.ts.map +1 -1
- package/dist/commonjs/models/invoice.js +7 -6
- package/dist/commonjs/models/invoice.js.map +1 -1
- package/dist/commonjs/models/meteredentitlementdetail.d.ts +9 -5
- package/dist/commonjs/models/meteredentitlementdetail.d.ts.map +1 -1
- package/dist/commonjs/models/meteredentitlementdetail.js +1 -0
- package/dist/commonjs/models/meteredentitlementdetail.js.map +1 -1
- package/dist/commonjs/models/meteredentitlementlistitem.d.ts +9 -5
- package/dist/commonjs/models/meteredentitlementlistitem.d.ts.map +1 -1
- package/dist/commonjs/models/meteredentitlementlistitem.js +1 -0
- package/dist/commonjs/models/meteredentitlementlistitem.js.map +1 -1
- package/dist/commonjs/models/operations/createplan.d.ts +11 -5
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +6 -3
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/createprice.d.ts +7 -17
- package/dist/commonjs/models/operations/createprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createprice.js +3 -13
- package/dist/commonjs/models/operations/createprice.js.map +1 -1
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js +63 -0
- package/dist/commonjs/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
- package/dist/commonjs/models/operations/updateplan.d.ts +6 -0
- package/dist/commonjs/models/operations/updateplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateplan.js +3 -0
- package/dist/commonjs/models/operations/updateplan.js.map +1 -1
- package/dist/commonjs/models/operations/updateprice.d.ts +7 -17
- package/dist/commonjs/models/operations/updateprice.d.ts.map +1 -1
- package/dist/commonjs/models/operations/updateprice.js +3 -13
- package/dist/commonjs/models/operations/updateprice.js.map +1 -1
- package/dist/commonjs/models/plan.d.ts +5 -0
- package/dist/commonjs/models/plan.d.ts.map +1 -1
- package/dist/commonjs/models/plan.js +2 -0
- package/dist/commonjs/models/plan.js.map +1 -1
- package/dist/commonjs/models/plancreditallocation.d.ts +30 -0
- package/dist/commonjs/models/plancreditallocation.d.ts.map +1 -0
- package/dist/commonjs/models/plancreditallocation.js +62 -0
- package/dist/commonjs/models/plancreditallocation.js.map +1 -0
- package/dist/commonjs/models/price.d.ts +4 -4
- package/dist/commonjs/models/price.d.ts.map +1 -1
- package/dist/commonjs/models/price.js +5 -5
- package/dist/commonjs/models/price.js.map +1 -1
- package/dist/commonjs/models/pricemodel.d.ts +18 -0
- package/dist/commonjs/models/pricemodel.d.ts.map +1 -0
- package/dist/commonjs/models/pricemodel.js +52 -0
- package/dist/commonjs/models/pricemodel.js.map +1 -0
- package/dist/commonjs/models/pricemodelinput.d.ts +15 -0
- package/dist/commonjs/models/pricemodelinput.d.ts.map +1 -0
- package/dist/commonjs/models/pricemodelinput.js +49 -0
- package/dist/commonjs/models/pricemodelinput.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureadded.d.ts +15 -0
- package/dist/commonjs/models/reconciledfeatureadded.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureadded.js +52 -0
- package/dist/commonjs/models/reconciledfeatureadded.js.map +1 -0
- package/dist/commonjs/models/reconciledfeaturefailed.d.ts +29 -0
- package/dist/commonjs/models/reconciledfeaturefailed.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeaturefailed.js +62 -0
- package/dist/commonjs/models/reconciledfeaturefailed.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureremoved.d.ts +11 -0
- package/dist/commonjs/models/reconciledfeatureremoved.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureremoved.js +51 -0
- package/dist/commonjs/models/reconciledfeatureremoved.js.map +1 -0
- package/dist/commonjs/models/reconciledfeatureskipped.d.ts +11 -0
- package/dist/commonjs/models/reconciledfeatureskipped.d.ts.map +1 -0
- package/dist/commonjs/models/reconciledfeatureskipped.js +51 -0
- package/dist/commonjs/models/reconciledfeatureskipped.js.map +1 -0
- package/dist/commonjs/models/schemasprice.d.ts +9 -10
- package/dist/commonjs/models/schemasprice.d.ts.map +1 -1
- package/dist/commonjs/models/schemasprice.js +4 -10
- package/dist/commonjs/models/schemasprice.js.map +1 -1
- package/dist/commonjs/models/subscriptionreconciliation.d.ts +62 -0
- package/dist/commonjs/models/subscriptionreconciliation.d.ts.map +1 -0
- package/dist/commonjs/models/subscriptionreconciliation.js +83 -0
- package/dist/commonjs/models/subscriptionreconciliation.js.map +1 -0
- package/dist/commonjs/sdk/subscriptions.d.ts +7 -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/pricesCreate.js +2 -2
- package/dist/esm/funcs/pricesCreate.js.map +1 -1
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts +19 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.d.ts.map +1 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js +89 -0
- package/dist/esm/funcs/subscriptionsReconcileSubscriptionFeatures.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/index.d.ts +8 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +8 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/invoice.d.ts +4 -4
- package/dist/esm/models/invoice.d.ts.map +1 -1
- package/dist/esm/models/invoice.js +5 -4
- package/dist/esm/models/invoice.js.map +1 -1
- package/dist/esm/models/meteredentitlementdetail.d.ts +9 -5
- package/dist/esm/models/meteredentitlementdetail.d.ts.map +1 -1
- package/dist/esm/models/meteredentitlementdetail.js +1 -0
- package/dist/esm/models/meteredentitlementdetail.js.map +1 -1
- package/dist/esm/models/meteredentitlementlistitem.d.ts +9 -5
- package/dist/esm/models/meteredentitlementlistitem.d.ts.map +1 -1
- package/dist/esm/models/meteredentitlementlistitem.js +1 -0
- package/dist/esm/models/meteredentitlementlistitem.js.map +1 -1
- package/dist/esm/models/operations/createplan.d.ts +11 -5
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +6 -3
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/createprice.d.ts +7 -17
- package/dist/esm/models/operations/createprice.d.ts.map +1 -1
- package/dist/esm/models/operations/createprice.js +2 -12
- package/dist/esm/models/operations/createprice.js.map +1 -1
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts +30 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.d.ts.map +1 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.js +25 -0
- package/dist/esm/models/operations/reconcilesubscriptionfeatures.js.map +1 -0
- package/dist/esm/models/operations/updateplan.d.ts +6 -0
- package/dist/esm/models/operations/updateplan.d.ts.map +1 -1
- package/dist/esm/models/operations/updateplan.js +3 -0
- package/dist/esm/models/operations/updateplan.js.map +1 -1
- package/dist/esm/models/operations/updateprice.d.ts +7 -17
- package/dist/esm/models/operations/updateprice.d.ts.map +1 -1
- package/dist/esm/models/operations/updateprice.js +2 -12
- package/dist/esm/models/operations/updateprice.js.map +1 -1
- package/dist/esm/models/plan.d.ts +5 -0
- package/dist/esm/models/plan.d.ts.map +1 -1
- package/dist/esm/models/plan.js +2 -0
- package/dist/esm/models/plan.js.map +1 -1
- package/dist/esm/models/plancreditallocation.d.ts +30 -0
- package/dist/esm/models/plancreditallocation.d.ts.map +1 -0
- package/dist/esm/models/plancreditallocation.js +24 -0
- package/dist/esm/models/plancreditallocation.js.map +1 -0
- package/dist/esm/models/price.d.ts +4 -4
- package/dist/esm/models/price.d.ts.map +1 -1
- package/dist/esm/models/price.js +4 -4
- package/dist/esm/models/price.js.map +1 -1
- package/dist/esm/models/pricemodel.d.ts +18 -0
- package/dist/esm/models/pricemodel.d.ts.map +1 -0
- package/dist/esm/models/pricemodel.js +16 -0
- package/dist/esm/models/pricemodel.js.map +1 -0
- package/dist/esm/models/pricemodelinput.d.ts +15 -0
- package/dist/esm/models/pricemodelinput.d.ts.map +1 -0
- package/dist/esm/models/pricemodelinput.js +13 -0
- package/dist/esm/models/pricemodelinput.js.map +1 -0
- package/dist/esm/models/reconciledfeatureadded.d.ts +15 -0
- package/dist/esm/models/reconciledfeatureadded.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureadded.js +15 -0
- package/dist/esm/models/reconciledfeatureadded.js.map +1 -0
- package/dist/esm/models/reconciledfeaturefailed.d.ts +29 -0
- package/dist/esm/models/reconciledfeaturefailed.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeaturefailed.js +25 -0
- package/dist/esm/models/reconciledfeaturefailed.js.map +1 -0
- package/dist/esm/models/reconciledfeatureremoved.d.ts +11 -0
- package/dist/esm/models/reconciledfeatureremoved.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureremoved.js +14 -0
- package/dist/esm/models/reconciledfeatureremoved.js.map +1 -0
- package/dist/esm/models/reconciledfeatureskipped.d.ts +11 -0
- package/dist/esm/models/reconciledfeatureskipped.d.ts.map +1 -0
- package/dist/esm/models/reconciledfeatureskipped.js +14 -0
- package/dist/esm/models/reconciledfeatureskipped.js.map +1 -0
- package/dist/esm/models/schemasprice.d.ts +9 -10
- package/dist/esm/models/schemasprice.d.ts.map +1 -1
- package/dist/esm/models/schemasprice.js +3 -9
- package/dist/esm/models/schemasprice.js.map +1 -1
- package/dist/esm/models/subscriptionreconciliation.d.ts +62 -0
- package/dist/esm/models/subscriptionreconciliation.d.ts.map +1 -0
- package/dist/esm/models/subscriptionreconciliation.js +44 -0
- package/dist/esm/models/subscriptionreconciliation.js.map +1 -0
- package/dist/esm/sdk/subscriptions.d.ts +7 -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/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/pricesCreate.ts +2 -2
- package/src/funcs/subscriptionsReconcileSubscriptionFeatures.ts +184 -0
- package/src/lib/config.ts +2 -2
- package/src/models/index.ts +8 -0
- package/src/models/invoice.ts +10 -9
- package/src/models/meteredentitlementdetail.ts +10 -5
- package/src/models/meteredentitlementlistitem.ts +10 -5
- package/src/models/operations/createplan.ts +15 -7
- package/src/models/operations/createprice.ts +9 -22
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/reconcilesubscriptionfeatures.ts +78 -0
- package/src/models/operations/updateplan.ts +8 -0
- package/src/models/operations/updateprice.ts +9 -22
- package/src/models/plan.ts +9 -0
- package/src/models/plancreditallocation.ts +68 -0
- package/src/models/price.ts +6 -6
- package/src/models/pricemodel.ts +28 -0
- package/src/models/pricemodelinput.ts +22 -0
- package/src/models/reconciledfeatureadded.ts +38 -0
- package/src/models/reconciledfeaturefailed.ts +55 -0
- package/src/models/reconciledfeatureremoved.ts +33 -0
- package/src/models/reconciledfeatureskipped.ts +33 -0
- package/src/models/schemasprice.ts +11 -15
- package/src/models/subscriptionreconciliation.ts +144 -0
- package/src/sdk/subscriptions.ts +18 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { PaygenticCore } from "../core.js";
|
|
6
|
+
import { encodeJSON, 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
|
+
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 { PaygenticError } from "../models/errors/paygenticerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as models from "../models/index.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Reconcile Features
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Creates a reconciliation that converges a subscription's feature entitlements to its current plan. Provisions a missing entitlement (and, for metered features, its initial grant) for every plan feature the subscription does not already have; cancels the entitlement and voids the grants of any feature no longer on the plan; then synchronizes the corresponding prices' billing. An already-present feature is left unchanged. Restricted to active subscriptions billed on their plan's line-item schedule.
|
|
34
|
+
*/
|
|
35
|
+
export function subscriptionsReconcileSubscriptionFeatures(
|
|
36
|
+
client: PaygenticCore,
|
|
37
|
+
request: operations.ReconcileSubscriptionFeaturesRequest,
|
|
38
|
+
options?: RequestOptions,
|
|
39
|
+
): APIPromise<
|
|
40
|
+
Result<
|
|
41
|
+
models.SubscriptionReconciliation,
|
|
42
|
+
| errors.BadRequest
|
|
43
|
+
| errors.ErrorT
|
|
44
|
+
| PaygenticError
|
|
45
|
+
| ResponseValidationError
|
|
46
|
+
| ConnectionError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| InvalidRequestError
|
|
50
|
+
| UnexpectedClientError
|
|
51
|
+
| SDKValidationError
|
|
52
|
+
>
|
|
53
|
+
> {
|
|
54
|
+
return new APIPromise($do(
|
|
55
|
+
client,
|
|
56
|
+
request,
|
|
57
|
+
options,
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function $do(
|
|
62
|
+
client: PaygenticCore,
|
|
63
|
+
request: operations.ReconcileSubscriptionFeaturesRequest,
|
|
64
|
+
options?: RequestOptions,
|
|
65
|
+
): Promise<
|
|
66
|
+
[
|
|
67
|
+
Result<
|
|
68
|
+
models.SubscriptionReconciliation,
|
|
69
|
+
| errors.BadRequest
|
|
70
|
+
| errors.ErrorT
|
|
71
|
+
| PaygenticError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) =>
|
|
86
|
+
operations.ReconcileSubscriptionFeaturesRequest$outboundSchema.parse(
|
|
87
|
+
value,
|
|
88
|
+
),
|
|
89
|
+
"Input validation failed",
|
|
90
|
+
);
|
|
91
|
+
if (!parsed.ok) {
|
|
92
|
+
return [parsed, { status: "invalid" }];
|
|
93
|
+
}
|
|
94
|
+
const payload = parsed.value;
|
|
95
|
+
const body = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
96
|
+
|
|
97
|
+
const pathParams = {
|
|
98
|
+
id: encodeSimple("id", payload.id, {
|
|
99
|
+
explode: false,
|
|
100
|
+
charEncoding: "percent",
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
103
|
+
const path = pathToFunc("/v0/subscriptions/{id}/reconciliations")(pathParams);
|
|
104
|
+
|
|
105
|
+
const headers = new Headers(compactMap({
|
|
106
|
+
"Content-Type": "application/json",
|
|
107
|
+
Accept: "application/json",
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
const secConfig = await extractSecurity(client._options.bearerAuth);
|
|
111
|
+
const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
|
|
112
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
113
|
+
|
|
114
|
+
const context = {
|
|
115
|
+
options: client._options,
|
|
116
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
117
|
+
operationID: "reconcileSubscriptionFeatures",
|
|
118
|
+
oAuth2Scopes: null,
|
|
119
|
+
|
|
120
|
+
resolvedSecurity: requestSecurity,
|
|
121
|
+
|
|
122
|
+
securitySource: client._options.bearerAuth,
|
|
123
|
+
retryConfig: options?.retries
|
|
124
|
+
|| client._options.retryConfig
|
|
125
|
+
|| { strategy: "none" },
|
|
126
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const requestRes = client._createRequest(context, {
|
|
130
|
+
security: requestSecurity,
|
|
131
|
+
method: "POST",
|
|
132
|
+
baseURL: options?.serverURL,
|
|
133
|
+
path: path,
|
|
134
|
+
headers: headers,
|
|
135
|
+
body: body,
|
|
136
|
+
userAgent: client._options.userAgent,
|
|
137
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
138
|
+
}, options);
|
|
139
|
+
if (!requestRes.ok) {
|
|
140
|
+
return [requestRes, { status: "invalid" }];
|
|
141
|
+
}
|
|
142
|
+
const req = requestRes.value;
|
|
143
|
+
|
|
144
|
+
const doResult = await client._do(req, {
|
|
145
|
+
context,
|
|
146
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
147
|
+
retryConfig: context.retryConfig,
|
|
148
|
+
retryCodes: context.retryCodes,
|
|
149
|
+
});
|
|
150
|
+
if (!doResult.ok) {
|
|
151
|
+
return [doResult, { status: "request-error", request: req }];
|
|
152
|
+
}
|
|
153
|
+
const response = doResult.value;
|
|
154
|
+
|
|
155
|
+
const responseFields = {
|
|
156
|
+
HttpMeta: { Response: response, Request: req },
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const [result] = await M.match<
|
|
160
|
+
models.SubscriptionReconciliation,
|
|
161
|
+
| errors.BadRequest
|
|
162
|
+
| errors.ErrorT
|
|
163
|
+
| PaygenticError
|
|
164
|
+
| ResponseValidationError
|
|
165
|
+
| ConnectionError
|
|
166
|
+
| RequestAbortedError
|
|
167
|
+
| RequestTimeoutError
|
|
168
|
+
| InvalidRequestError
|
|
169
|
+
| UnexpectedClientError
|
|
170
|
+
| SDKValidationError
|
|
171
|
+
>(
|
|
172
|
+
M.json([200, 201], models.SubscriptionReconciliation$inboundSchema),
|
|
173
|
+
M.jsonErr(400, errors.BadRequest$inboundSchema),
|
|
174
|
+
M.jsonErr([401, 403, 404], errors.ErrorT$inboundSchema),
|
|
175
|
+
M.jsonErr(500, errors.ErrorT$inboundSchema),
|
|
176
|
+
M.fail("4XX"),
|
|
177
|
+
M.fail("5XX"),
|
|
178
|
+
)(response, req, { extraFields: responseFields });
|
|
179
|
+
if (!result.ok) {
|
|
180
|
+
return [result, { status: "complete", request: req, response }];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return [result, { status: "complete", request: req, response }];
|
|
184
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -65,7 +65,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
65
65
|
export const SDK_METADATA = {
|
|
66
66
|
language: "typescript",
|
|
67
67
|
openapiDocVersion: "0.1.0",
|
|
68
|
-
sdkVersion: "0.
|
|
68
|
+
sdkVersion: "0.8.1",
|
|
69
69
|
genVersion: "2.879.13",
|
|
70
|
-
userAgent: "speakeasy-sdk/typescript 0.
|
|
70
|
+
userAgent: "speakeasy-sdk/typescript 0.8.1 2.879.13 0.1.0 @paygentic/sdk",
|
|
71
71
|
} as const;
|
package/src/models/index.ts
CHANGED
|
@@ -65,9 +65,12 @@ export * from "./paymentmethod.js";
|
|
|
65
65
|
export * from "./paymentsession.js";
|
|
66
66
|
export * from "./paymentsummary.js";
|
|
67
67
|
export * from "./plan.js";
|
|
68
|
+
export * from "./plancreditallocation.js";
|
|
68
69
|
export * from "./price.js";
|
|
69
70
|
export * from "./pricefeature.js";
|
|
70
71
|
export * from "./pricefeatureinput.js";
|
|
72
|
+
export * from "./pricemodel.js";
|
|
73
|
+
export * from "./pricemodelinput.js";
|
|
71
74
|
export * from "./pricepropertiesunion.js";
|
|
72
75
|
export * from "./product.js";
|
|
73
76
|
export * from "./profitabilityrow.js";
|
|
@@ -75,6 +78,10 @@ export * from "./profitabilitysummaryresponse.js";
|
|
|
75
78
|
export * from "./profitabilitytrend.js";
|
|
76
79
|
export * from "./purchasegrantrequest.js";
|
|
77
80
|
export * from "./purchasegrantresponse.js";
|
|
81
|
+
export * from "./reconciledfeatureadded.js";
|
|
82
|
+
export * from "./reconciledfeaturefailed.js";
|
|
83
|
+
export * from "./reconciledfeatureremoved.js";
|
|
84
|
+
export * from "./reconciledfeatureskipped.js";
|
|
78
85
|
export * from "./replacescheduleintervalsrequest.js";
|
|
79
86
|
export * from "./revenuesummaryresponse.js";
|
|
80
87
|
export * from "./revenuetrendbucket.js";
|
|
@@ -94,6 +101,7 @@ export * from "./staticentitlementlistitem.js";
|
|
|
94
101
|
export * from "./subscription.js";
|
|
95
102
|
export * from "./subscriptionmetadata.js";
|
|
96
103
|
export * from "./subscriptionportal.js";
|
|
104
|
+
export * from "./subscriptionreconciliation.js";
|
|
97
105
|
export * from "./testclock.js";
|
|
98
106
|
export * from "./updateapprovalrequest.js";
|
|
99
107
|
export * from "./updatebillingschedulerequest.js";
|
package/src/models/invoice.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type InvoiceObject = ClosedEnum<typeof InvoiceObject>;
|
|
|
26
26
|
/**
|
|
27
27
|
* Line items (only present if expand=lineItems query parameter is provided)
|
|
28
28
|
*/
|
|
29
|
-
export type
|
|
29
|
+
export type InvoiceLineItems = {
|
|
30
30
|
/**
|
|
31
31
|
* The invoice ID
|
|
32
32
|
*/
|
|
@@ -156,7 +156,7 @@ export type Invoice = {
|
|
|
156
156
|
/**
|
|
157
157
|
* Line items (only present if expand=lineItems query parameter is provided)
|
|
158
158
|
*/
|
|
159
|
-
lineItems?:
|
|
159
|
+
lineItems?: InvoiceLineItems | null | undefined;
|
|
160
160
|
/**
|
|
161
161
|
* The merchant organization ID
|
|
162
162
|
*/
|
|
@@ -245,8 +245,8 @@ export const InvoiceObject$inboundSchema: z.ZodNativeEnum<
|
|
|
245
245
|
> = z.nativeEnum(InvoiceObject);
|
|
246
246
|
|
|
247
247
|
/** @internal */
|
|
248
|
-
export const
|
|
249
|
-
|
|
248
|
+
export const InvoiceLineItems$inboundSchema: z.ZodType<
|
|
249
|
+
InvoiceLineItems,
|
|
250
250
|
z.ZodTypeDef,
|
|
251
251
|
unknown
|
|
252
252
|
> = z.object({
|
|
@@ -256,13 +256,13 @@ export const LineItems$inboundSchema: z.ZodType<
|
|
|
256
256
|
totalCount: z.number().int(),
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
export function
|
|
259
|
+
export function invoiceLineItemsFromJSON(
|
|
260
260
|
jsonString: string,
|
|
261
|
-
): SafeParseResult<
|
|
261
|
+
): SafeParseResult<InvoiceLineItems, SDKValidationError> {
|
|
262
262
|
return safeParse(
|
|
263
263
|
jsonString,
|
|
264
|
-
(x) =>
|
|
265
|
-
`Failed to parse '
|
|
264
|
+
(x) => InvoiceLineItems$inboundSchema.parse(JSON.parse(x)),
|
|
265
|
+
`Failed to parse 'InvoiceLineItems' from JSON`,
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
@@ -317,7 +317,8 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
|
|
|
317
317
|
grandTotal: z.string(),
|
|
318
318
|
invoiceNumber: z.nullable(z.string()).optional(),
|
|
319
319
|
itemCount: z.number().int(),
|
|
320
|
-
lineItems: z.nullable(z.lazy(() =>
|
|
320
|
+
lineItems: z.nullable(z.lazy(() => InvoiceLineItems$inboundSchema))
|
|
321
|
+
.optional(),
|
|
321
322
|
merchantId: z.string(),
|
|
322
323
|
metadata: z.record(z.any()).optional(),
|
|
323
324
|
nextActionAt: z.nullable(
|
|
@@ -78,23 +78,27 @@ export type MeteredEntitlementDetail = {
|
|
|
78
78
|
*/
|
|
79
79
|
isSoftLimit: boolean;
|
|
80
80
|
/**
|
|
81
|
-
* Remaining
|
|
81
|
+
* Remaining balance for the current period. When `pricingUnitId` is set, this is expressed in that pricing unit's credits (a balance shared across every feature drawing the same unit); otherwise it is in the feature's native metered units.
|
|
82
82
|
*/
|
|
83
83
|
balance: number;
|
|
84
84
|
/**
|
|
85
|
-
* Total usage consumed in the current billing period.
|
|
85
|
+
* Total usage consumed in the current billing period, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units). When `pricingUnitId` is set, this is the shared-pool aggregate across every feature drawing the same unit, not usage specific to this feature.
|
|
86
86
|
*/
|
|
87
87
|
usageInPeriod: number;
|
|
88
88
|
/**
|
|
89
|
-
* Amount of usage exceeding the
|
|
89
|
+
* Amount of usage exceeding the balance, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units).
|
|
90
90
|
*/
|
|
91
91
|
overage: number;
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* The pricing unit this feature is denominated in when it draws a credit pool. When set, `balance`/`usageInPeriod`/`overage` are in that unit's credits and reflect a balance shared across all features on the same unit. `null` for currency-denominated features (native metered units).
|
|
94
|
+
*/
|
|
95
|
+
pricingUnitId: string | null;
|
|
96
|
+
/**
|
|
97
|
+
* Start of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
|
|
94
98
|
*/
|
|
95
99
|
currentPeriodStart: Date | null;
|
|
96
100
|
/**
|
|
97
|
-
* End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
101
|
+
* End of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
98
102
|
*/
|
|
99
103
|
currentPeriodEnd: Date | null;
|
|
100
104
|
};
|
|
@@ -130,6 +134,7 @@ export const MeteredEntitlementDetail$inboundSchema: z.ZodType<
|
|
|
130
134
|
balance: z.number(),
|
|
131
135
|
usageInPeriod: z.number(),
|
|
132
136
|
overage: z.number(),
|
|
137
|
+
pricingUnitId: z.nullable(z.string()),
|
|
133
138
|
currentPeriodStart: z.nullable(
|
|
134
139
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
135
140
|
),
|
|
@@ -69,23 +69,27 @@ export type MeteredEntitlementListItem = {
|
|
|
69
69
|
*/
|
|
70
70
|
isSoftLimit: boolean;
|
|
71
71
|
/**
|
|
72
|
-
* Remaining
|
|
72
|
+
* Remaining balance for the current period. When `pricingUnitId` is set, this is expressed in that pricing unit's credits (a balance shared across every feature drawing the same unit); otherwise it is in the feature's native metered units.
|
|
73
73
|
*/
|
|
74
74
|
balance: number;
|
|
75
75
|
/**
|
|
76
|
-
* Total usage consumed in the current billing period.
|
|
76
|
+
* Total usage consumed in the current billing period, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units). When `pricingUnitId` is set, this is the shared-pool aggregate across every feature drawing the same unit, not usage specific to this feature.
|
|
77
77
|
*/
|
|
78
78
|
usageInPeriod: number;
|
|
79
79
|
/**
|
|
80
|
-
* Amount of usage exceeding the
|
|
80
|
+
* Amount of usage exceeding the balance, in the same unit as `balance` (credits when `pricingUnitId` is set, otherwise native metered units).
|
|
81
81
|
*/
|
|
82
82
|
overage: number;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* The pricing unit this feature is denominated in when it draws a credit pool. When set, `balance`/`usageInPeriod`/`overage` are in that unit's credits and reflect a balance shared across all features on the same unit. `null` for currency-denominated features (native metered units).
|
|
85
|
+
*/
|
|
86
|
+
pricingUnitId: string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Start of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead describes the pre-activation `[subscription start, activation)` window and may be `null` when there is no associated subscription.
|
|
85
89
|
*/
|
|
86
90
|
currentPeriodStart: Date | null;
|
|
87
91
|
/**
|
|
88
|
-
* End of the current usage period. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
92
|
+
* End of the current usage period. These bounds describe this entitlement's own usage window (not the shared pool's), even for a pool-backed feature (`pricingUnitId` set) whose `balance` and `usageInPeriod` are shared-pool aggregates. Before the entitlement activates (the pre-activation "dark window", when the query time is earlier than `activeFrom`) this instead holds `activeFrom` — the end of the pre-activation `[subscription start, activation)` window.
|
|
89
93
|
*/
|
|
90
94
|
currentPeriodEnd: Date | null;
|
|
91
95
|
};
|
|
@@ -115,6 +119,7 @@ export const MeteredEntitlementListItem$inboundSchema: z.ZodType<
|
|
|
115
119
|
balance: z.number(),
|
|
116
120
|
usageInPeriod: z.number(),
|
|
117
121
|
overage: z.number(),
|
|
122
|
+
pricingUnitId: z.nullable(z.string()),
|
|
118
123
|
currentPeriodStart: z.nullable(
|
|
119
124
|
z.string().datetime({ offset: true }).transform(v => new Date(v)),
|
|
120
125
|
),
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* ISO 8601 duration for the billing period. Takes precedence over billingInterval when both are provided.
|
|
@@ -49,14 +50,14 @@ export const CreatePlanTaxBehavior = {
|
|
|
49
50
|
export type CreatePlanTaxBehavior = ClosedEnum<typeof CreatePlanTaxBehavior>;
|
|
50
51
|
|
|
51
52
|
/**
|
|
52
|
-
* Billing engine version.
|
|
53
|
+
* Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
|
|
53
54
|
*/
|
|
54
55
|
export const BillingVersion = {
|
|
55
56
|
Zero: 0,
|
|
56
57
|
One: 1,
|
|
57
58
|
} as const;
|
|
58
59
|
/**
|
|
59
|
-
* Billing engine version.
|
|
60
|
+
* Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
|
|
60
61
|
*/
|
|
61
62
|
export type BillingVersion = ClosedEnum<typeof BillingVersion>;
|
|
62
63
|
|
|
@@ -104,7 +105,7 @@ export type CreatePlanRequest = {
|
|
|
104
105
|
/**
|
|
105
106
|
* Unique identifier for a product
|
|
106
107
|
*/
|
|
107
|
-
productId
|
|
108
|
+
productId: string;
|
|
108
109
|
/**
|
|
109
110
|
* Whether tax is added on top of the price (exclusive) or included in the price (inclusive)
|
|
110
111
|
*/
|
|
@@ -118,13 +119,17 @@ export type CreatePlanRequest = {
|
|
|
118
119
|
*/
|
|
119
120
|
renewalReminderDays?: number | undefined;
|
|
120
121
|
/**
|
|
121
|
-
* Billing engine version.
|
|
122
|
+
* Billing engine version. Only 1 (Standard, line-item billing with metered usage support) is accepted for new plans; omitting the field defaults to 1. 0 (Legacy, fee-schedule billing) is rejected — it exists only on plans created before this restriction.
|
|
122
123
|
*/
|
|
123
124
|
billingVersion?: BillingVersion | undefined;
|
|
124
125
|
/**
|
|
125
126
|
* ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. When set, subscriptions created under this plan align their first billing period to the next recurrence of this anchor.
|
|
126
127
|
*/
|
|
127
128
|
billingAnchor?: Date | null | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
|
|
131
|
+
*/
|
|
132
|
+
creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
|
|
128
133
|
};
|
|
129
134
|
|
|
130
135
|
/** @internal */
|
|
@@ -159,12 +164,13 @@ export type CreatePlanRequest$Outbound = {
|
|
|
159
164
|
merchantId: string;
|
|
160
165
|
name: string;
|
|
161
166
|
prices?: Array<string> | undefined;
|
|
162
|
-
productId
|
|
167
|
+
productId: string;
|
|
163
168
|
taxBehavior: string;
|
|
164
169
|
renewalReminderEnabled: boolean;
|
|
165
170
|
renewalReminderDays: number;
|
|
166
171
|
billingVersion: number;
|
|
167
172
|
billingAnchor?: string | null | undefined;
|
|
173
|
+
creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
|
|
168
174
|
};
|
|
169
175
|
|
|
170
176
|
/** @internal */
|
|
@@ -183,13 +189,15 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
|
|
|
183
189
|
merchantId: z.string(),
|
|
184
190
|
name: z.string(),
|
|
185
191
|
prices: z.array(z.string()).optional(),
|
|
186
|
-
productId: z.string()
|
|
192
|
+
productId: z.string(),
|
|
187
193
|
taxBehavior: CreatePlanTaxBehavior$outboundSchema.default("exclusive"),
|
|
188
194
|
renewalReminderEnabled: z.boolean().default(true),
|
|
189
195
|
renewalReminderDays: z.number().int().default(3),
|
|
190
|
-
billingVersion: BillingVersion$outboundSchema.default(
|
|
196
|
+
billingVersion: BillingVersion$outboundSchema.default(1),
|
|
191
197
|
billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
|
|
192
198
|
.optional(),
|
|
199
|
+
creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
|
|
200
|
+
.optional(),
|
|
193
201
|
});
|
|
194
202
|
|
|
195
203
|
export function createPlanRequestToJSON(
|
|
@@ -6,20 +6,6 @@ import * as z from "zod/v3";
|
|
|
6
6
|
import { ClosedEnum } from "../../types/enums.js";
|
|
7
7
|
import * as models from "../index.js";
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
|
|
11
|
-
*/
|
|
12
|
-
export const CreatePriceModel = {
|
|
13
|
-
Standard: "standard",
|
|
14
|
-
Dynamic: "dynamic",
|
|
15
|
-
Volume: "volume",
|
|
16
|
-
Percentage: "percentage",
|
|
17
|
-
} as const;
|
|
18
|
-
/**
|
|
19
|
-
* Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard').
|
|
20
|
-
*/
|
|
21
|
-
export type CreatePriceModel = ClosedEnum<typeof CreatePriceModel>;
|
|
22
|
-
|
|
23
9
|
/**
|
|
24
10
|
* Billing timing preference. For billable metrics: 'instant' (charges immediately) or 'in_arrears' (charges at period end). For fees: 'in_advance' (charges upfront) or 'in_arrears' (charges at period end).
|
|
25
11
|
*/
|
|
@@ -43,9 +29,13 @@ export type CreatePriceRequest = {
|
|
|
43
29
|
*/
|
|
44
30
|
feeId?: string | undefined;
|
|
45
31
|
/**
|
|
46
|
-
*
|
|
32
|
+
* Unique identifier for a pricing unit
|
|
33
|
+
*/
|
|
34
|
+
pricingUnitId?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Pricing calculation model. Required for billable metrics, optional for fees (defaults to 'standard'). Only 'standard' is accepted; for percentage/revenue-share use 'standard' with a unit-price multiplier. Legacy prices using 'dynamic'/'volume'/'percentage' stay readable and billable but cannot be created.
|
|
47
37
|
*/
|
|
48
|
-
model?:
|
|
38
|
+
model?: models.PriceModelInput | undefined;
|
|
49
39
|
/**
|
|
50
40
|
* Line item label shown on customer invoices. Sample values: 'Claude Token Consumption', 'Storage Usage (GB)', 'Inference API Calls', 'Image Generation Count', 'Training Compute Hours', 'Data Transfer (TB)'
|
|
51
41
|
*/
|
|
@@ -70,11 +60,6 @@ export type CreatePriceRequest = {
|
|
|
70
60
|
quantity?: number | undefined;
|
|
71
61
|
};
|
|
72
62
|
|
|
73
|
-
/** @internal */
|
|
74
|
-
export const CreatePriceModel$outboundSchema: z.ZodNativeEnum<
|
|
75
|
-
typeof CreatePriceModel
|
|
76
|
-
> = z.nativeEnum(CreatePriceModel);
|
|
77
|
-
|
|
78
63
|
/** @internal */
|
|
79
64
|
export const CreatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
|
|
80
65
|
typeof CreatePricePaymentTerm
|
|
@@ -84,6 +69,7 @@ export const CreatePricePaymentTerm$outboundSchema: z.ZodNativeEnum<
|
|
|
84
69
|
export type CreatePriceRequest$Outbound = {
|
|
85
70
|
billableMetricId?: string | undefined;
|
|
86
71
|
feeId?: string | undefined;
|
|
72
|
+
pricingUnitId?: string | undefined;
|
|
87
73
|
model?: string | undefined;
|
|
88
74
|
invoiceDisplayName: string;
|
|
89
75
|
paymentTerm: string;
|
|
@@ -102,7 +88,8 @@ export const CreatePriceRequest$outboundSchema: z.ZodType<
|
|
|
102
88
|
> = z.object({
|
|
103
89
|
billableMetricId: z.string().optional(),
|
|
104
90
|
feeId: z.string().optional(),
|
|
105
|
-
|
|
91
|
+
pricingUnitId: z.string().optional(),
|
|
92
|
+
model: models.PriceModelInput$outboundSchema.optional(),
|
|
106
93
|
invoiceDisplayName: z.string(),
|
|
107
94
|
paymentTerm: CreatePricePaymentTerm$outboundSchema,
|
|
108
95
|
billingCadence: z.nullable(z.string()).optional(),
|
|
@@ -105,6 +105,7 @@ export * from "./listsources.js";
|
|
|
105
105
|
export * from "./listsubscriptions.js";
|
|
106
106
|
export * from "./listtestclocks.js";
|
|
107
107
|
export * from "./purchaseentitlementgrant.js";
|
|
108
|
+
export * from "./reconcilesubscriptionfeatures.js";
|
|
108
109
|
export * from "./rejectsourceevent.js";
|
|
109
110
|
export * from "./replacescheduleintervals.js";
|
|
110
111
|
export * from "./terminatesubscription.js";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
|
|
8
|
+
export type ReconcileSubscriptionFeaturesRequestBody = {
|
|
9
|
+
/**
|
|
10
|
+
* Preview the outcome without creating any entitlement, grant, or line item.
|
|
11
|
+
*/
|
|
12
|
+
dryRun?: boolean | undefined;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type ReconcileSubscriptionFeaturesRequest = {
|
|
16
|
+
/**
|
|
17
|
+
* The subscription ID
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
requestBody?: ReconcileSubscriptionFeaturesRequestBody | undefined;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** @internal */
|
|
24
|
+
export type ReconcileSubscriptionFeaturesRequestBody$Outbound = {
|
|
25
|
+
dryRun: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const ReconcileSubscriptionFeaturesRequestBody$outboundSchema: z.ZodType<
|
|
30
|
+
ReconcileSubscriptionFeaturesRequestBody$Outbound,
|
|
31
|
+
z.ZodTypeDef,
|
|
32
|
+
ReconcileSubscriptionFeaturesRequestBody
|
|
33
|
+
> = z.object({
|
|
34
|
+
dryRun: z.boolean().default(false),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export function reconcileSubscriptionFeaturesRequestBodyToJSON(
|
|
38
|
+
reconcileSubscriptionFeaturesRequestBody:
|
|
39
|
+
ReconcileSubscriptionFeaturesRequestBody,
|
|
40
|
+
): string {
|
|
41
|
+
return JSON.stringify(
|
|
42
|
+
ReconcileSubscriptionFeaturesRequestBody$outboundSchema.parse(
|
|
43
|
+
reconcileSubscriptionFeaturesRequestBody,
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** @internal */
|
|
49
|
+
export type ReconcileSubscriptionFeaturesRequest$Outbound = {
|
|
50
|
+
id: string;
|
|
51
|
+
RequestBody?: ReconcileSubscriptionFeaturesRequestBody$Outbound | undefined;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** @internal */
|
|
55
|
+
export const ReconcileSubscriptionFeaturesRequest$outboundSchema: z.ZodType<
|
|
56
|
+
ReconcileSubscriptionFeaturesRequest$Outbound,
|
|
57
|
+
z.ZodTypeDef,
|
|
58
|
+
ReconcileSubscriptionFeaturesRequest
|
|
59
|
+
> = z.object({
|
|
60
|
+
id: z.string(),
|
|
61
|
+
requestBody: z.lazy(() =>
|
|
62
|
+
ReconcileSubscriptionFeaturesRequestBody$outboundSchema
|
|
63
|
+
).optional(),
|
|
64
|
+
}).transform((v) => {
|
|
65
|
+
return remap$(v, {
|
|
66
|
+
requestBody: "RequestBody",
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
export function reconcileSubscriptionFeaturesRequestToJSON(
|
|
71
|
+
reconcileSubscriptionFeaturesRequest: ReconcileSubscriptionFeaturesRequest,
|
|
72
|
+
): string {
|
|
73
|
+
return JSON.stringify(
|
|
74
|
+
ReconcileSubscriptionFeaturesRequest$outboundSchema.parse(
|
|
75
|
+
reconcileSubscriptionFeaturesRequest,
|
|
76
|
+
),
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as z from "zod/v3";
|
|
6
6
|
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
7
|
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import * as models from "../index.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* ISO 8601 duration for the billing period. Takes precedence over billingInterval when both are provided.
|
|
@@ -98,6 +99,10 @@ export type UpdatePlanRequestBody = {
|
|
|
98
99
|
* ISO 8601 datetime reference point for billing period alignment. Must be in the past or present. Set to null to clear the anchor and revert to start-time-based anchoring.
|
|
99
100
|
*/
|
|
100
101
|
billingAnchor?: Date | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Credit-pool funding declarations for this plan. Each entry funds a distinct pricing unit's credit pool when a subscription to this plan activates: the allocated amount is minted as a credit grant on the customer's pool for that pricing unit, once at activation, or on a recurring basis only when that allocation explicitly sets recurrencePeriod. A plan may declare zero or more allocations; no two allocations on the same plan may target the same pricingUnitId.
|
|
104
|
+
*/
|
|
105
|
+
creditAllocations?: Array<models.PlanCreditAllocation> | undefined;
|
|
101
106
|
};
|
|
102
107
|
|
|
103
108
|
export type UpdatePlanRequest = {
|
|
@@ -137,6 +142,7 @@ export type UpdatePlanRequestBody$Outbound = {
|
|
|
137
142
|
renewalReminderEnabled?: boolean | undefined;
|
|
138
143
|
renewalReminderDays?: number | undefined;
|
|
139
144
|
billingAnchor?: string | null | undefined;
|
|
145
|
+
creditAllocations?: Array<models.PlanCreditAllocation$Outbound> | undefined;
|
|
140
146
|
};
|
|
141
147
|
|
|
142
148
|
/** @internal */
|
|
@@ -158,6 +164,8 @@ export const UpdatePlanRequestBody$outboundSchema: z.ZodType<
|
|
|
158
164
|
renewalReminderDays: z.number().int().optional(),
|
|
159
165
|
billingAnchor: z.nullable(z.date().transform(v => v.toISOString()))
|
|
160
166
|
.optional(),
|
|
167
|
+
creditAllocations: z.array(models.PlanCreditAllocation$outboundSchema)
|
|
168
|
+
.optional(),
|
|
161
169
|
});
|
|
162
170
|
|
|
163
171
|
export function updatePlanRequestBodyToJSON(
|