@schematichq/schematic-typescript-node 1.1.1 → 1.1.4
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/Client.d.ts +10 -0
- package/Client.js +88 -0
- package/api/resources/accesstokens/client/Client.js +1 -1
- package/api/resources/accounts/client/Client.js +14 -14
- package/api/resources/billing/client/Client.d.ts +61 -0
- package/api/resources/billing/client/Client.js +392 -8
- package/api/resources/billing/client/requests/ChangeSubscriptionRequestBody.d.ts +16 -0
- package/api/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.d.ts +13 -0
- package/api/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.d.ts +13 -0
- package/api/resources/billing/client/requests/index.d.ts +3 -0
- package/api/resources/billing/types/ChangeSubscriptionWebResponse.d.ts +9 -0
- package/api/resources/billing/types/CreateBillingPlanGroupResponse.d.ts +9 -0
- package/api/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.d.ts +9 -0
- package/api/resources/billing/types/UpdateBillingPlanGroupResponse.d.ts +9 -0
- package/api/resources/billing/types/index.d.ts +4 -0
- package/api/resources/billing/types/index.js +4 -0
- package/api/resources/companies/client/Client.d.ts +0 -13
- package/api/resources/companies/client/Client.js +31 -136
- package/api/resources/companies/client/requests/index.d.ts +0 -1
- package/api/resources/companies/types/index.d.ts +0 -2
- package/api/resources/companies/types/index.js +0 -2
- package/api/resources/components/client/Client.d.ts +0 -1
- package/api/resources/components/client/Client.js +7 -8
- package/api/resources/components/client/requests/CreateComponentRequestBody.d.ts +1 -2
- package/api/resources/components/client/requests/UpdateComponentRequestBody.d.ts +1 -1
- package/api/resources/crm/client/Client.js +5 -5
- package/api/resources/entitlements/client/Client.js +19 -19
- package/api/resources/events/client/Client.js +8 -8
- package/api/resources/features/client/Client.js +19 -19
- package/api/resources/plans/client/Client.d.ts +12 -1
- package/api/resources/plans/client/Client.js +99 -11
- package/api/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -1
- package/api/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -2
- package/api/resources/{companies/types/ListCompanyPlansResponse.d.ts → plans/types/ListActivePlansResponse.d.ts} +3 -3
- package/api/resources/plans/types/index.d.ts +1 -0
- package/api/resources/plans/types/index.js +1 -0
- package/api/resources/webhooks/client/Client.js +9 -9
- package/api/types/BillingPlan.d.ts +11 -0
- package/api/types/BillingPlan.js +5 -0
- package/api/types/BillingPlanGroupResponseData.d.ts +11 -0
- package/api/types/BillingPlanGroupResponseData.js +5 -0
- package/api/types/BillingProductForSubscriptionResponseData.d.ts +16 -0
- package/api/types/BillingProductForSubscriptionResponseData.js +5 -0
- package/api/types/BillingProductPricing.d.ts +2 -0
- package/api/types/CompanyDetailResponseData.d.ts +1 -1
- package/api/types/CompanySubscriptionResponseData.d.ts +1 -1
- package/api/types/PlanDetailResponseData.d.ts +0 -1
- package/api/types/PlanResponseData.d.ts +0 -1
- package/api/types/index.d.ts +3 -1
- package/api/types/index.js +3 -1
- package/dist/Client.d.ts +10 -0
- package/dist/Client.js +88 -0
- package/dist/api/resources/accesstokens/client/Client.js +1 -1
- package/dist/api/resources/accounts/client/Client.js +14 -14
- package/dist/api/resources/billing/client/Client.d.ts +61 -0
- package/dist/api/resources/billing/client/Client.js +392 -8
- package/dist/api/resources/billing/client/requests/ChangeSubscriptionRequestBody.d.ts +16 -0
- package/dist/api/resources/billing/client/requests/ChangeSubscriptionRequestBody.js +5 -0
- package/dist/api/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.d.ts +13 -0
- package/dist/api/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.js +5 -0
- package/dist/api/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.d.ts +13 -0
- package/dist/api/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.js +5 -0
- package/dist/api/resources/billing/client/requests/index.d.ts +3 -0
- package/dist/api/resources/billing/types/ChangeSubscriptionWebResponse.d.ts +9 -0
- package/dist/api/resources/billing/types/ChangeSubscriptionWebResponse.js +5 -0
- package/dist/api/resources/billing/types/CreateBillingPlanGroupResponse.d.ts +9 -0
- package/dist/api/resources/billing/types/CreateBillingPlanGroupResponse.js +5 -0
- package/dist/api/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.d.ts +9 -0
- package/dist/api/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.js +5 -0
- package/dist/api/resources/billing/types/UpdateBillingPlanGroupResponse.d.ts +9 -0
- package/dist/api/resources/billing/types/UpdateBillingPlanGroupResponse.js +5 -0
- package/dist/api/resources/billing/types/index.d.ts +4 -0
- package/dist/api/resources/billing/types/index.js +4 -0
- package/dist/api/resources/companies/client/Client.d.ts +0 -13
- package/dist/api/resources/companies/client/Client.js +31 -136
- package/dist/api/resources/companies/client/requests/index.d.ts +0 -1
- package/dist/api/resources/companies/types/index.d.ts +0 -2
- package/dist/api/resources/companies/types/index.js +0 -2
- package/dist/api/resources/components/client/Client.d.ts +0 -1
- package/dist/api/resources/components/client/Client.js +7 -8
- package/dist/api/resources/components/client/requests/CreateComponentRequestBody.d.ts +1 -2
- package/dist/api/resources/components/client/requests/UpdateComponentRequestBody.d.ts +1 -1
- package/dist/api/resources/crm/client/Client.js +5 -5
- package/dist/api/resources/entitlements/client/Client.js +19 -19
- package/dist/api/resources/events/client/Client.js +8 -8
- package/dist/api/resources/features/client/Client.js +19 -19
- package/dist/api/resources/plans/client/Client.d.ts +12 -1
- package/dist/api/resources/plans/client/Client.js +99 -11
- package/dist/api/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -1
- package/dist/api/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -2
- package/dist/api/resources/{companies/types/ListCompanyPlansResponse.d.ts → plans/types/ListActivePlansResponse.d.ts} +3 -3
- package/dist/api/resources/plans/types/ListActivePlansResponse.js +5 -0
- package/dist/api/resources/plans/types/index.d.ts +1 -0
- package/dist/api/resources/plans/types/index.js +1 -0
- package/dist/api/resources/webhooks/client/Client.js +9 -9
- package/dist/api/types/BillingPlan.d.ts +11 -0
- package/dist/api/types/BillingPlan.js +5 -0
- package/dist/api/types/BillingPlanGroupResponseData.d.ts +11 -0
- package/dist/api/types/BillingPlanGroupResponseData.js +5 -0
- package/dist/api/types/BillingProductForSubscriptionResponseData.d.ts +16 -0
- package/dist/api/types/BillingProductForSubscriptionResponseData.js +5 -0
- package/dist/api/types/BillingProductPricing.d.ts +2 -0
- package/dist/api/types/CompanyDetailResponseData.d.ts +1 -1
- package/dist/api/types/CompanySubscriptionResponseData.d.ts +1 -1
- package/dist/api/types/PlanDetailResponseData.d.ts +0 -1
- package/dist/api/types/PlanResponseData.d.ts +0 -1
- package/dist/api/types/index.d.ts +3 -1
- package/dist/api/types/index.js +3 -1
- package/dist/events.d.ts +3 -0
- package/dist/events.js +17 -5
- package/dist/serialization/resources/billing/client/requests/ChangeSubscriptionRequestBody.d.ts +14 -0
- package/dist/serialization/resources/billing/client/requests/ChangeSubscriptionRequestBody.js +35 -0
- package/dist/serialization/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.d.ts +13 -0
- package/dist/serialization/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.js +34 -0
- package/dist/serialization/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.d.ts +13 -0
- package/dist/serialization/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.js +34 -0
- package/dist/serialization/resources/billing/client/requests/index.d.ts +3 -0
- package/dist/serialization/resources/billing/client/requests/index.js +7 -1
- package/dist/serialization/resources/billing/types/ChangeSubscriptionWebResponse.d.ts +14 -0
- package/dist/serialization/resources/{companies/types/ListCompanyPlansParams.js → billing/types/ChangeSubscriptionWebResponse.js} +5 -6
- package/dist/serialization/resources/billing/types/CreateBillingPlanGroupResponse.d.ts +14 -0
- package/{serialization/resources/companies/types/ListCompanyPlansParams.js → dist/serialization/resources/billing/types/CreateBillingPlanGroupResponse.js} +5 -6
- package/dist/serialization/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.d.ts +14 -0
- package/dist/serialization/resources/{companies/types/ListCompanyPlansResponse.js → billing/types/GetBillingPlanGroupByAccountIdResponse.js} +5 -6
- package/dist/serialization/resources/billing/types/UpdateBillingPlanGroupResponse.d.ts +14 -0
- package/{serialization/resources/companies/types/ListCompanyPlansResponse.js → dist/serialization/resources/billing/types/UpdateBillingPlanGroupResponse.js} +5 -6
- package/dist/serialization/resources/billing/types/index.d.ts +4 -0
- package/dist/serialization/resources/billing/types/index.js +4 -0
- package/dist/serialization/resources/companies/types/index.d.ts +0 -2
- package/dist/serialization/resources/companies/types/index.js +0 -2
- package/dist/serialization/resources/components/client/requests/CreateComponentRequestBody.d.ts +1 -1
- package/dist/serialization/resources/components/client/requests/CreateComponentRequestBody.js +1 -1
- package/dist/serialization/resources/components/client/requests/UpdateComponentRequestBody.d.ts +1 -1
- package/dist/serialization/resources/components/client/requests/UpdateComponentRequestBody.js +1 -1
- package/dist/serialization/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -1
- package/dist/serialization/resources/plans/client/requests/CreatePlanRequestBody.js +0 -1
- package/dist/serialization/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -1
- package/dist/serialization/resources/plans/client/requests/UpdatePlanRequestBody.js +0 -1
- package/dist/serialization/resources/plans/types/ListActivePlansResponse.d.ts +14 -0
- package/dist/serialization/resources/plans/types/ListActivePlansResponse.js +35 -0
- package/dist/serialization/resources/plans/types/index.d.ts +1 -0
- package/dist/serialization/resources/plans/types/index.js +1 -0
- package/dist/serialization/types/BillingPlan.d.ts +17 -0
- package/dist/serialization/types/BillingPlan.js +38 -0
- package/dist/serialization/types/BillingPlanGroupResponseData.d.ts +14 -0
- package/dist/serialization/types/BillingPlanGroupResponseData.js +35 -0
- package/dist/serialization/types/BillingProductForSubscriptionResponseData.d.ts +22 -0
- package/{serialization/types/CompanyPlanResponseData.js → dist/serialization/types/BillingProductForSubscriptionResponseData.js} +9 -4
- package/dist/serialization/types/BillingProductPricing.d.ts +2 -0
- package/dist/serialization/types/BillingProductPricing.js +2 -0
- package/dist/serialization/types/CompanyDetailResponseData.d.ts +2 -1
- package/dist/serialization/types/CompanyDetailResponseData.js +2 -1
- package/dist/serialization/types/CompanySubscriptionResponseData.d.ts +2 -2
- package/dist/serialization/types/CompanySubscriptionResponseData.js +2 -2
- package/dist/serialization/types/PlanDetailResponseData.d.ts +0 -1
- package/dist/serialization/types/PlanDetailResponseData.js +0 -1
- package/dist/serialization/types/PlanResponseData.d.ts +0 -1
- package/dist/serialization/types/PlanResponseData.js +0 -1
- package/dist/serialization/types/index.d.ts +3 -1
- package/dist/serialization/types/index.js +3 -1
- package/dist/wrapper.js +21 -19
- package/events.d.ts +3 -0
- package/events.js +17 -5
- package/package.json +10 -13
- package/reference.md +282 -50
- package/serialization/resources/billing/client/requests/ChangeSubscriptionRequestBody.d.ts +14 -0
- package/serialization/resources/billing/client/requests/ChangeSubscriptionRequestBody.js +35 -0
- package/serialization/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.d.ts +13 -0
- package/serialization/resources/billing/client/requests/CreateBillingPlanGroupRequestBody.js +34 -0
- package/serialization/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.d.ts +13 -0
- package/serialization/resources/billing/client/requests/UpdateBillingPlanGroupRequestBody.js +34 -0
- package/serialization/resources/billing/client/requests/index.d.ts +3 -0
- package/serialization/resources/billing/client/requests/index.js +7 -1
- package/serialization/resources/billing/types/ChangeSubscriptionWebResponse.d.ts +14 -0
- package/serialization/resources/billing/types/ChangeSubscriptionWebResponse.js +35 -0
- package/serialization/resources/billing/types/CreateBillingPlanGroupResponse.d.ts +14 -0
- package/serialization/resources/billing/types/CreateBillingPlanGroupResponse.js +35 -0
- package/serialization/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.d.ts +14 -0
- package/serialization/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.js +35 -0
- package/serialization/resources/billing/types/UpdateBillingPlanGroupResponse.d.ts +14 -0
- package/serialization/resources/billing/types/UpdateBillingPlanGroupResponse.js +35 -0
- package/serialization/resources/billing/types/index.d.ts +4 -0
- package/serialization/resources/billing/types/index.js +4 -0
- package/serialization/resources/companies/types/index.d.ts +0 -2
- package/serialization/resources/companies/types/index.js +0 -2
- package/serialization/resources/components/client/requests/CreateComponentRequestBody.d.ts +1 -1
- package/serialization/resources/components/client/requests/CreateComponentRequestBody.js +1 -1
- package/serialization/resources/components/client/requests/UpdateComponentRequestBody.d.ts +1 -1
- package/serialization/resources/components/client/requests/UpdateComponentRequestBody.js +1 -1
- package/serialization/resources/plans/client/requests/CreatePlanRequestBody.d.ts +0 -1
- package/serialization/resources/plans/client/requests/CreatePlanRequestBody.js +0 -1
- package/serialization/resources/plans/client/requests/UpdatePlanRequestBody.d.ts +0 -1
- package/serialization/resources/plans/client/requests/UpdatePlanRequestBody.js +0 -1
- package/serialization/resources/plans/types/ListActivePlansResponse.d.ts +14 -0
- package/serialization/resources/plans/types/ListActivePlansResponse.js +35 -0
- package/serialization/resources/plans/types/index.d.ts +1 -0
- package/serialization/resources/plans/types/index.js +1 -0
- package/serialization/types/BillingPlan.d.ts +17 -0
- package/serialization/types/BillingPlan.js +38 -0
- package/serialization/types/BillingPlanGroupResponseData.d.ts +14 -0
- package/serialization/types/BillingPlanGroupResponseData.js +35 -0
- package/serialization/types/BillingProductForSubscriptionResponseData.d.ts +22 -0
- package/{dist/serialization/types/CompanyPlanResponseData.js → serialization/types/BillingProductForSubscriptionResponseData.js} +9 -4
- package/serialization/types/BillingProductPricing.d.ts +2 -0
- package/serialization/types/BillingProductPricing.js +2 -0
- package/serialization/types/CompanyDetailResponseData.d.ts +2 -1
- package/serialization/types/CompanyDetailResponseData.js +2 -1
- package/serialization/types/CompanySubscriptionResponseData.d.ts +2 -2
- package/serialization/types/CompanySubscriptionResponseData.js +2 -2
- package/serialization/types/PlanDetailResponseData.d.ts +0 -1
- package/serialization/types/PlanDetailResponseData.js +0 -1
- package/serialization/types/PlanResponseData.d.ts +0 -1
- package/serialization/types/PlanResponseData.js +0 -1
- package/serialization/types/index.d.ts +3 -1
- package/serialization/types/index.js +3 -1
- package/wrapper.js +21 -19
- package/.husky/pre-commit +0 -1
- package/api/resources/companies/client/requests/ListCompanyPlansRequest.d.ts +0 -19
- package/api/resources/companies/types/ListCompanyPlansParams.d.ts +0 -14
- package/api/types/CompanyPlanResponseData.d.ts +0 -11
- package/dist/api/resources/companies/client/requests/ListCompanyPlansRequest.d.ts +0 -19
- package/dist/api/resources/companies/types/ListCompanyPlansParams.d.ts +0 -14
- package/dist/api/types/CompanyPlanResponseData.d.ts +0 -11
- package/dist/serialization/resources/companies/types/ListCompanyPlansParams.d.ts +0 -15
- package/dist/serialization/resources/companies/types/ListCompanyPlansResponse.d.ts +0 -15
- package/dist/serialization/types/CompanyPlanResponseData.d.ts +0 -17
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -4
- package/generate-version.js +0 -6
- package/serialization/resources/companies/types/ListCompanyPlansParams.d.ts +0 -15
- package/serialization/resources/companies/types/ListCompanyPlansResponse.d.ts +0 -15
- package/serialization/types/CompanyPlanResponseData.d.ts +0 -17
- package/version.d.ts +0 -1
- package/version.js +0 -4
- /package/api/resources/{companies/client/requests/ListCompanyPlansRequest.js → billing/client/requests/ChangeSubscriptionRequestBody.js} +0 -0
- /package/api/resources/{companies/types/ListCompanyPlansParams.js → billing/client/requests/CreateBillingPlanGroupRequestBody.js} +0 -0
- /package/api/resources/{companies/types/ListCompanyPlansResponse.js → billing/client/requests/UpdateBillingPlanGroupRequestBody.js} +0 -0
- /package/api/{types/CompanyPlanResponseData.js → resources/billing/types/ChangeSubscriptionWebResponse.js} +0 -0
- /package/{dist/api/resources/companies/client/requests/ListCompanyPlansRequest.js → api/resources/billing/types/CreateBillingPlanGroupResponse.js} +0 -0
- /package/{dist/api/resources/companies/types/ListCompanyPlansParams.js → api/resources/billing/types/GetBillingPlanGroupByAccountIdResponse.js} +0 -0
- /package/{dist/api/resources/companies/types/ListCompanyPlansResponse.js → api/resources/billing/types/UpdateBillingPlanGroupResponse.js} +0 -0
- /package/{dist/api/types/CompanyPlanResponseData.js → api/resources/plans/types/ListActivePlansResponse.js} +0 -0
|
@@ -75,7 +75,7 @@ class Billing {
|
|
|
75
75
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
76
76
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/customer/upsert"),
|
|
77
77
|
method: "POST",
|
|
78
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
78
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
79
79
|
contentType: "application/json",
|
|
80
80
|
requestType: "json",
|
|
81
81
|
body: serializers.CreateBillingCustomerRequestBody.jsonOrThrow(request, {
|
|
@@ -185,7 +185,7 @@ class Billing {
|
|
|
185
185
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
186
186
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/customers"),
|
|
187
187
|
method: "GET",
|
|
188
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
188
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
189
189
|
contentType: "application/json",
|
|
190
190
|
queryParameters: _queryParams,
|
|
191
191
|
requestType: "json",
|
|
@@ -293,7 +293,7 @@ class Billing {
|
|
|
293
293
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
294
294
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/customers/count"),
|
|
295
295
|
method: "GET",
|
|
296
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
296
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
297
297
|
contentType: "application/json",
|
|
298
298
|
queryParameters: _queryParams,
|
|
299
299
|
requestType: "json",
|
|
@@ -366,6 +366,295 @@ class Billing {
|
|
|
366
366
|
}
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
+
/**
|
|
370
|
+
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
|
|
371
|
+
*
|
|
372
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
373
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
374
|
+
* @throws {@link Schematic.NotFoundError}
|
|
375
|
+
* @throws {@link Schematic.InternalServerError}
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* await client.billing.getBillingPlanGroupByAccountId()
|
|
379
|
+
*/
|
|
380
|
+
getBillingPlanGroupByAccountId(requestOptions) {
|
|
381
|
+
var _a, _b;
|
|
382
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
383
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
384
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/plan-group"),
|
|
385
|
+
method: "GET",
|
|
386
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
387
|
+
contentType: "application/json",
|
|
388
|
+
requestType: "json",
|
|
389
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
390
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
391
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
392
|
+
});
|
|
393
|
+
if (_response.ok) {
|
|
394
|
+
return serializers.GetBillingPlanGroupByAccountIdResponse.parseOrThrow(_response.body, {
|
|
395
|
+
unrecognizedObjectKeys: "passthrough",
|
|
396
|
+
allowUnrecognizedUnionMembers: true,
|
|
397
|
+
allowUnrecognizedEnumValues: true,
|
|
398
|
+
skipValidation: true,
|
|
399
|
+
breadcrumbsPrefix: ["response"],
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
if (_response.error.reason === "status-code") {
|
|
403
|
+
switch (_response.error.statusCode) {
|
|
404
|
+
case 401:
|
|
405
|
+
throw new Schematic.UnauthorizedError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
406
|
+
unrecognizedObjectKeys: "passthrough",
|
|
407
|
+
allowUnrecognizedUnionMembers: true,
|
|
408
|
+
allowUnrecognizedEnumValues: true,
|
|
409
|
+
skipValidation: true,
|
|
410
|
+
breadcrumbsPrefix: ["response"],
|
|
411
|
+
}));
|
|
412
|
+
case 403:
|
|
413
|
+
throw new Schematic.ForbiddenError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
414
|
+
unrecognizedObjectKeys: "passthrough",
|
|
415
|
+
allowUnrecognizedUnionMembers: true,
|
|
416
|
+
allowUnrecognizedEnumValues: true,
|
|
417
|
+
skipValidation: true,
|
|
418
|
+
breadcrumbsPrefix: ["response"],
|
|
419
|
+
}));
|
|
420
|
+
case 404:
|
|
421
|
+
throw new Schematic.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
422
|
+
unrecognizedObjectKeys: "passthrough",
|
|
423
|
+
allowUnrecognizedUnionMembers: true,
|
|
424
|
+
allowUnrecognizedEnumValues: true,
|
|
425
|
+
skipValidation: true,
|
|
426
|
+
breadcrumbsPrefix: ["response"],
|
|
427
|
+
}));
|
|
428
|
+
case 500:
|
|
429
|
+
throw new Schematic.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
430
|
+
unrecognizedObjectKeys: "passthrough",
|
|
431
|
+
allowUnrecognizedUnionMembers: true,
|
|
432
|
+
allowUnrecognizedEnumValues: true,
|
|
433
|
+
skipValidation: true,
|
|
434
|
+
breadcrumbsPrefix: ["response"],
|
|
435
|
+
}));
|
|
436
|
+
default:
|
|
437
|
+
throw new errors.SchematicError({
|
|
438
|
+
statusCode: _response.error.statusCode,
|
|
439
|
+
body: _response.error.body,
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
switch (_response.error.reason) {
|
|
444
|
+
case "non-json":
|
|
445
|
+
throw new errors.SchematicError({
|
|
446
|
+
statusCode: _response.error.statusCode,
|
|
447
|
+
body: _response.error.rawBody,
|
|
448
|
+
});
|
|
449
|
+
case "timeout":
|
|
450
|
+
throw new errors.SchematicTimeoutError();
|
|
451
|
+
case "unknown":
|
|
452
|
+
throw new errors.SchematicError({
|
|
453
|
+
message: _response.error.errorMessage,
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* @param {Schematic.CreateBillingPlanGroupRequestBody} request
|
|
460
|
+
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
|
|
461
|
+
*
|
|
462
|
+
* @throws {@link Schematic.BadRequestError}
|
|
463
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
464
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
465
|
+
* @throws {@link Schematic.InternalServerError}
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* await client.billing.createBillingPlanGroup({
|
|
469
|
+
* planIds: ["plan_ids"]
|
|
470
|
+
* })
|
|
471
|
+
*/
|
|
472
|
+
createBillingPlanGroup(request, requestOptions) {
|
|
473
|
+
var _a, _b;
|
|
474
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
475
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
476
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/plan-group"),
|
|
477
|
+
method: "POST",
|
|
478
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
479
|
+
contentType: "application/json",
|
|
480
|
+
requestType: "json",
|
|
481
|
+
body: serializers.CreateBillingPlanGroupRequestBody.jsonOrThrow(request, {
|
|
482
|
+
unrecognizedObjectKeys: "strip",
|
|
483
|
+
}),
|
|
484
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
485
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
486
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
487
|
+
});
|
|
488
|
+
if (_response.ok) {
|
|
489
|
+
return serializers.CreateBillingPlanGroupResponse.parseOrThrow(_response.body, {
|
|
490
|
+
unrecognizedObjectKeys: "passthrough",
|
|
491
|
+
allowUnrecognizedUnionMembers: true,
|
|
492
|
+
allowUnrecognizedEnumValues: true,
|
|
493
|
+
skipValidation: true,
|
|
494
|
+
breadcrumbsPrefix: ["response"],
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
if (_response.error.reason === "status-code") {
|
|
498
|
+
switch (_response.error.statusCode) {
|
|
499
|
+
case 400:
|
|
500
|
+
throw new Schematic.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
501
|
+
unrecognizedObjectKeys: "passthrough",
|
|
502
|
+
allowUnrecognizedUnionMembers: true,
|
|
503
|
+
allowUnrecognizedEnumValues: true,
|
|
504
|
+
skipValidation: true,
|
|
505
|
+
breadcrumbsPrefix: ["response"],
|
|
506
|
+
}));
|
|
507
|
+
case 401:
|
|
508
|
+
throw new Schematic.UnauthorizedError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
509
|
+
unrecognizedObjectKeys: "passthrough",
|
|
510
|
+
allowUnrecognizedUnionMembers: true,
|
|
511
|
+
allowUnrecognizedEnumValues: true,
|
|
512
|
+
skipValidation: true,
|
|
513
|
+
breadcrumbsPrefix: ["response"],
|
|
514
|
+
}));
|
|
515
|
+
case 403:
|
|
516
|
+
throw new Schematic.ForbiddenError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
517
|
+
unrecognizedObjectKeys: "passthrough",
|
|
518
|
+
allowUnrecognizedUnionMembers: true,
|
|
519
|
+
allowUnrecognizedEnumValues: true,
|
|
520
|
+
skipValidation: true,
|
|
521
|
+
breadcrumbsPrefix: ["response"],
|
|
522
|
+
}));
|
|
523
|
+
case 500:
|
|
524
|
+
throw new Schematic.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
525
|
+
unrecognizedObjectKeys: "passthrough",
|
|
526
|
+
allowUnrecognizedUnionMembers: true,
|
|
527
|
+
allowUnrecognizedEnumValues: true,
|
|
528
|
+
skipValidation: true,
|
|
529
|
+
breadcrumbsPrefix: ["response"],
|
|
530
|
+
}));
|
|
531
|
+
default:
|
|
532
|
+
throw new errors.SchematicError({
|
|
533
|
+
statusCode: _response.error.statusCode,
|
|
534
|
+
body: _response.error.body,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
switch (_response.error.reason) {
|
|
539
|
+
case "non-json":
|
|
540
|
+
throw new errors.SchematicError({
|
|
541
|
+
statusCode: _response.error.statusCode,
|
|
542
|
+
body: _response.error.rawBody,
|
|
543
|
+
});
|
|
544
|
+
case "timeout":
|
|
545
|
+
throw new errors.SchematicTimeoutError();
|
|
546
|
+
case "unknown":
|
|
547
|
+
throw new errors.SchematicError({
|
|
548
|
+
message: _response.error.errorMessage,
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* @param {string} billingId - billing_id
|
|
555
|
+
* @param {Schematic.UpdateBillingPlanGroupRequestBody} request
|
|
556
|
+
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
|
|
557
|
+
*
|
|
558
|
+
* @throws {@link Schematic.BadRequestError}
|
|
559
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
560
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
561
|
+
* @throws {@link Schematic.NotFoundError}
|
|
562
|
+
* @throws {@link Schematic.InternalServerError}
|
|
563
|
+
*
|
|
564
|
+
* @example
|
|
565
|
+
* await client.billing.updateBillingPlanGroup("billing_id", {
|
|
566
|
+
* planIds: ["plan_ids"]
|
|
567
|
+
* })
|
|
568
|
+
*/
|
|
569
|
+
updateBillingPlanGroup(billingId, request, requestOptions) {
|
|
570
|
+
var _a, _b;
|
|
571
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
572
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
573
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, `billing/plan-group/${encodeURIComponent(billingId)}`),
|
|
574
|
+
method: "PUT",
|
|
575
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
576
|
+
contentType: "application/json",
|
|
577
|
+
requestType: "json",
|
|
578
|
+
body: serializers.UpdateBillingPlanGroupRequestBody.jsonOrThrow(request, {
|
|
579
|
+
unrecognizedObjectKeys: "strip",
|
|
580
|
+
}),
|
|
581
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
582
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
583
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
584
|
+
});
|
|
585
|
+
if (_response.ok) {
|
|
586
|
+
return serializers.UpdateBillingPlanGroupResponse.parseOrThrow(_response.body, {
|
|
587
|
+
unrecognizedObjectKeys: "passthrough",
|
|
588
|
+
allowUnrecognizedUnionMembers: true,
|
|
589
|
+
allowUnrecognizedEnumValues: true,
|
|
590
|
+
skipValidation: true,
|
|
591
|
+
breadcrumbsPrefix: ["response"],
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
if (_response.error.reason === "status-code") {
|
|
595
|
+
switch (_response.error.statusCode) {
|
|
596
|
+
case 400:
|
|
597
|
+
throw new Schematic.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
598
|
+
unrecognizedObjectKeys: "passthrough",
|
|
599
|
+
allowUnrecognizedUnionMembers: true,
|
|
600
|
+
allowUnrecognizedEnumValues: true,
|
|
601
|
+
skipValidation: true,
|
|
602
|
+
breadcrumbsPrefix: ["response"],
|
|
603
|
+
}));
|
|
604
|
+
case 401:
|
|
605
|
+
throw new Schematic.UnauthorizedError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
606
|
+
unrecognizedObjectKeys: "passthrough",
|
|
607
|
+
allowUnrecognizedUnionMembers: true,
|
|
608
|
+
allowUnrecognizedEnumValues: true,
|
|
609
|
+
skipValidation: true,
|
|
610
|
+
breadcrumbsPrefix: ["response"],
|
|
611
|
+
}));
|
|
612
|
+
case 403:
|
|
613
|
+
throw new Schematic.ForbiddenError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
614
|
+
unrecognizedObjectKeys: "passthrough",
|
|
615
|
+
allowUnrecognizedUnionMembers: true,
|
|
616
|
+
allowUnrecognizedEnumValues: true,
|
|
617
|
+
skipValidation: true,
|
|
618
|
+
breadcrumbsPrefix: ["response"],
|
|
619
|
+
}));
|
|
620
|
+
case 404:
|
|
621
|
+
throw new Schematic.NotFoundError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
622
|
+
unrecognizedObjectKeys: "passthrough",
|
|
623
|
+
allowUnrecognizedUnionMembers: true,
|
|
624
|
+
allowUnrecognizedEnumValues: true,
|
|
625
|
+
skipValidation: true,
|
|
626
|
+
breadcrumbsPrefix: ["response"],
|
|
627
|
+
}));
|
|
628
|
+
case 500:
|
|
629
|
+
throw new Schematic.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
630
|
+
unrecognizedObjectKeys: "passthrough",
|
|
631
|
+
allowUnrecognizedUnionMembers: true,
|
|
632
|
+
allowUnrecognizedEnumValues: true,
|
|
633
|
+
skipValidation: true,
|
|
634
|
+
breadcrumbsPrefix: ["response"],
|
|
635
|
+
}));
|
|
636
|
+
default:
|
|
637
|
+
throw new errors.SchematicError({
|
|
638
|
+
statusCode: _response.error.statusCode,
|
|
639
|
+
body: _response.error.body,
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
switch (_response.error.reason) {
|
|
644
|
+
case "non-json":
|
|
645
|
+
throw new errors.SchematicError({
|
|
646
|
+
statusCode: _response.error.statusCode,
|
|
647
|
+
body: _response.error.rawBody,
|
|
648
|
+
});
|
|
649
|
+
case "timeout":
|
|
650
|
+
throw new errors.SchematicTimeoutError();
|
|
651
|
+
case "unknown":
|
|
652
|
+
throw new errors.SchematicError({
|
|
653
|
+
message: _response.error.errorMessage,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
}
|
|
369
658
|
/**
|
|
370
659
|
* @param {Schematic.CreateBillingPriceRequestBody} request
|
|
371
660
|
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -389,7 +678,7 @@ class Billing {
|
|
|
389
678
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
390
679
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/price/upsert"),
|
|
391
680
|
method: "POST",
|
|
392
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
681
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
393
682
|
contentType: "application/json",
|
|
394
683
|
requestType: "json",
|
|
395
684
|
body: serializers.CreateBillingPriceRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -502,7 +791,7 @@ class Billing {
|
|
|
502
791
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
503
792
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/product/prices"),
|
|
504
793
|
method: "GET",
|
|
505
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
794
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
506
795
|
contentType: "application/json",
|
|
507
796
|
queryParameters: _queryParams,
|
|
508
797
|
requestType: "json",
|
|
@@ -599,7 +888,7 @@ class Billing {
|
|
|
599
888
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
600
889
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/product/upsert"),
|
|
601
890
|
method: "POST",
|
|
602
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
891
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
603
892
|
contentType: "application/json",
|
|
604
893
|
requestType: "json",
|
|
605
894
|
body: serializers.CreateBillingProductRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -712,7 +1001,7 @@ class Billing {
|
|
|
712
1001
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
713
1002
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/products"),
|
|
714
1003
|
method: "GET",
|
|
715
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
1004
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
716
1005
|
contentType: "application/json",
|
|
717
1006
|
queryParameters: _queryParams,
|
|
718
1007
|
requestType: "json",
|
|
@@ -812,7 +1101,7 @@ class Billing {
|
|
|
812
1101
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
813
1102
|
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "billing/subscription/upsert"),
|
|
814
1103
|
method: "POST",
|
|
815
|
-
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.
|
|
1104
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
816
1105
|
contentType: "application/json",
|
|
817
1106
|
requestType: "json",
|
|
818
1107
|
body: serializers.CreateBillingSubscriptionsRequestBody.jsonOrThrow(request, {
|
|
@@ -887,6 +1176,101 @@ class Billing {
|
|
|
887
1176
|
}
|
|
888
1177
|
});
|
|
889
1178
|
}
|
|
1179
|
+
/**
|
|
1180
|
+
* @param {Schematic.ChangeSubscriptionRequestBody} request
|
|
1181
|
+
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
|
|
1182
|
+
*
|
|
1183
|
+
* @throws {@link Schematic.BadRequestError}
|
|
1184
|
+
* @throws {@link Schematic.UnauthorizedError}
|
|
1185
|
+
* @throws {@link Schematic.ForbiddenError}
|
|
1186
|
+
* @throws {@link Schematic.InternalServerError}
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* await client.billing.changeSubscriptionWeb({
|
|
1190
|
+
* action: "action",
|
|
1191
|
+
* newPlanId: "new_plan_id",
|
|
1192
|
+
* newPriceId: "new_price_id"
|
|
1193
|
+
* })
|
|
1194
|
+
*/
|
|
1195
|
+
changeSubscriptionWeb(request, requestOptions) {
|
|
1196
|
+
var _a, _b;
|
|
1197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1198
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
1199
|
+
url: (0, url_join_1.default)((_b = (yield core.Supplier.get(this._options.environment))) !== null && _b !== void 0 ? _b : environments.SchematicEnvironment.Default, "checkout"),
|
|
1200
|
+
method: "POST",
|
|
1201
|
+
headers: Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@schematichq/schematic-typescript-node", "X-Fern-SDK-Version": "1.1.4", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())),
|
|
1202
|
+
contentType: "application/json",
|
|
1203
|
+
requestType: "json",
|
|
1204
|
+
body: serializers.ChangeSubscriptionRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
1205
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
1206
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
1207
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
1208
|
+
});
|
|
1209
|
+
if (_response.ok) {
|
|
1210
|
+
return serializers.ChangeSubscriptionWebResponse.parseOrThrow(_response.body, {
|
|
1211
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1212
|
+
allowUnrecognizedUnionMembers: true,
|
|
1213
|
+
allowUnrecognizedEnumValues: true,
|
|
1214
|
+
skipValidation: true,
|
|
1215
|
+
breadcrumbsPrefix: ["response"],
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
if (_response.error.reason === "status-code") {
|
|
1219
|
+
switch (_response.error.statusCode) {
|
|
1220
|
+
case 400:
|
|
1221
|
+
throw new Schematic.BadRequestError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
1222
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1223
|
+
allowUnrecognizedUnionMembers: true,
|
|
1224
|
+
allowUnrecognizedEnumValues: true,
|
|
1225
|
+
skipValidation: true,
|
|
1226
|
+
breadcrumbsPrefix: ["response"],
|
|
1227
|
+
}));
|
|
1228
|
+
case 401:
|
|
1229
|
+
throw new Schematic.UnauthorizedError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
1230
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1231
|
+
allowUnrecognizedUnionMembers: true,
|
|
1232
|
+
allowUnrecognizedEnumValues: true,
|
|
1233
|
+
skipValidation: true,
|
|
1234
|
+
breadcrumbsPrefix: ["response"],
|
|
1235
|
+
}));
|
|
1236
|
+
case 403:
|
|
1237
|
+
throw new Schematic.ForbiddenError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
1238
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1239
|
+
allowUnrecognizedUnionMembers: true,
|
|
1240
|
+
allowUnrecognizedEnumValues: true,
|
|
1241
|
+
skipValidation: true,
|
|
1242
|
+
breadcrumbsPrefix: ["response"],
|
|
1243
|
+
}));
|
|
1244
|
+
case 500:
|
|
1245
|
+
throw new Schematic.InternalServerError(serializers.ApiError.parseOrThrow(_response.error.body, {
|
|
1246
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1247
|
+
allowUnrecognizedUnionMembers: true,
|
|
1248
|
+
allowUnrecognizedEnumValues: true,
|
|
1249
|
+
skipValidation: true,
|
|
1250
|
+
breadcrumbsPrefix: ["response"],
|
|
1251
|
+
}));
|
|
1252
|
+
default:
|
|
1253
|
+
throw new errors.SchematicError({
|
|
1254
|
+
statusCode: _response.error.statusCode,
|
|
1255
|
+
body: _response.error.body,
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
switch (_response.error.reason) {
|
|
1260
|
+
case "non-json":
|
|
1261
|
+
throw new errors.SchematicError({
|
|
1262
|
+
statusCode: _response.error.statusCode,
|
|
1263
|
+
body: _response.error.rawBody,
|
|
1264
|
+
});
|
|
1265
|
+
case "timeout":
|
|
1266
|
+
throw new errors.SchematicTimeoutError();
|
|
1267
|
+
case "unknown":
|
|
1268
|
+
throw new errors.SchematicError({
|
|
1269
|
+
message: _response.error.errorMessage,
|
|
1270
|
+
});
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
890
1274
|
_getCustomAuthorizationHeaders() {
|
|
891
1275
|
return __awaiter(this, void 0, void 0, function* () {
|
|
892
1276
|
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* action: "action",
|
|
8
|
+
* newPlanId: "new_plan_id",
|
|
9
|
+
* newPriceId: "new_price_id"
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface ChangeSubscriptionRequestBody {
|
|
13
|
+
action: string;
|
|
14
|
+
newPlanId: string;
|
|
15
|
+
newPriceId: string;
|
|
16
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export { type CreateBillingCustomerRequestBody } from "./CreateBillingCustomerRequestBody";
|
|
2
2
|
export { type ListCustomersRequest } from "./ListCustomersRequest";
|
|
3
3
|
export { type CountCustomersRequest } from "./CountCustomersRequest";
|
|
4
|
+
export { type CreateBillingPlanGroupRequestBody } from "./CreateBillingPlanGroupRequestBody";
|
|
5
|
+
export { type UpdateBillingPlanGroupRequestBody } from "./UpdateBillingPlanGroupRequestBody";
|
|
4
6
|
export { type CreateBillingPriceRequestBody } from "./CreateBillingPriceRequestBody";
|
|
5
7
|
export { type ListProductPricesRequest } from "./ListProductPricesRequest";
|
|
6
8
|
export { type CreateBillingProductRequestBody } from "./CreateBillingProductRequestBody";
|
|
7
9
|
export { type ListBillingProductsRequest } from "./ListBillingProductsRequest";
|
|
8
10
|
export { type CreateBillingSubscriptionsRequestBody } from "./CreateBillingSubscriptionsRequestBody";
|
|
11
|
+
export { type ChangeSubscriptionRequestBody } from "./ChangeSubscriptionRequestBody";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Schematic from "../../../index";
|
|
5
|
+
export interface ChangeSubscriptionWebResponse {
|
|
6
|
+
data: Schematic.BillingSubscriptionResponseData;
|
|
7
|
+
/** Input parameters */
|
|
8
|
+
params: Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Schematic from "../../../index";
|
|
5
|
+
export interface CreateBillingPlanGroupResponse {
|
|
6
|
+
data: Schematic.BillingPlanGroupResponseData;
|
|
7
|
+
/** Input parameters */
|
|
8
|
+
params: Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Schematic from "../../../index";
|
|
5
|
+
export interface GetBillingPlanGroupByAccountIdResponse {
|
|
6
|
+
data: Schematic.BillingPlanGroupResponseData;
|
|
7
|
+
/** Input parameters */
|
|
8
|
+
params: Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Schematic from "../../../index";
|
|
5
|
+
export interface UpdateBillingPlanGroupResponse {
|
|
6
|
+
data: Schematic.BillingPlanGroupResponseData;
|
|
7
|
+
/** Input parameters */
|
|
8
|
+
params: Record<string, unknown>;
|
|
9
|
+
}
|
|
@@ -3,6 +3,9 @@ export * from "./ListCustomersParams";
|
|
|
3
3
|
export * from "./ListCustomersResponse";
|
|
4
4
|
export * from "./CountCustomersParams";
|
|
5
5
|
export * from "./CountCustomersResponse";
|
|
6
|
+
export * from "./GetBillingPlanGroupByAccountIdResponse";
|
|
7
|
+
export * from "./CreateBillingPlanGroupResponse";
|
|
8
|
+
export * from "./UpdateBillingPlanGroupResponse";
|
|
6
9
|
export * from "./UpsertBillingPriceResponse";
|
|
7
10
|
export * from "./ListProductPricesParams";
|
|
8
11
|
export * from "./ListProductPricesResponse";
|
|
@@ -10,3 +13,4 @@ export * from "./UpsertBillingProductResponse";
|
|
|
10
13
|
export * from "./ListBillingProductsParams";
|
|
11
14
|
export * from "./ListBillingProductsResponse";
|
|
12
15
|
export * from "./UpsertBillingSubscriptionResponse";
|
|
16
|
+
export * from "./ChangeSubscriptionWebResponse";
|
|
@@ -19,6 +19,9 @@ __exportStar(require("./ListCustomersParams"), exports);
|
|
|
19
19
|
__exportStar(require("./ListCustomersResponse"), exports);
|
|
20
20
|
__exportStar(require("./CountCustomersParams"), exports);
|
|
21
21
|
__exportStar(require("./CountCustomersResponse"), exports);
|
|
22
|
+
__exportStar(require("./GetBillingPlanGroupByAccountIdResponse"), exports);
|
|
23
|
+
__exportStar(require("./CreateBillingPlanGroupResponse"), exports);
|
|
24
|
+
__exportStar(require("./UpdateBillingPlanGroupResponse"), exports);
|
|
22
25
|
__exportStar(require("./UpsertBillingPriceResponse"), exports);
|
|
23
26
|
__exportStar(require("./ListProductPricesParams"), exports);
|
|
24
27
|
__exportStar(require("./ListProductPricesResponse"), exports);
|
|
@@ -26,3 +29,4 @@ __exportStar(require("./UpsertBillingProductResponse"), exports);
|
|
|
26
29
|
__exportStar(require("./ListBillingProductsParams"), exports);
|
|
27
30
|
__exportStar(require("./ListBillingProductsResponse"), exports);
|
|
28
31
|
__exportStar(require("./UpsertBillingSubscriptionResponse"), exports);
|
|
32
|
+
__exportStar(require("./ChangeSubscriptionWebResponse"), exports);
|
|
@@ -202,19 +202,6 @@ export declare class Companies {
|
|
|
202
202
|
* await client.companies.deleteCompanyMembership("company_membership_id")
|
|
203
203
|
*/
|
|
204
204
|
deleteCompanyMembership(companyMembershipId: string, requestOptions?: Companies.RequestOptions): Promise<Schematic.DeleteCompanyMembershipResponse>;
|
|
205
|
-
/**
|
|
206
|
-
* @param {Schematic.ListCompanyPlansRequest} request
|
|
207
|
-
* @param {Companies.RequestOptions} requestOptions - Request-specific configuration.
|
|
208
|
-
*
|
|
209
|
-
* @throws {@link Schematic.BadRequestError}
|
|
210
|
-
* @throws {@link Schematic.UnauthorizedError}
|
|
211
|
-
* @throws {@link Schematic.ForbiddenError}
|
|
212
|
-
* @throws {@link Schematic.InternalServerError}
|
|
213
|
-
*
|
|
214
|
-
* @example
|
|
215
|
-
* await client.companies.listCompanyPlans()
|
|
216
|
-
*/
|
|
217
|
-
listCompanyPlans(request?: Schematic.ListCompanyPlansRequest, requestOptions?: Companies.RequestOptions): Promise<Schematic.ListCompanyPlansResponse>;
|
|
218
205
|
/**
|
|
219
206
|
* @param {Schematic.GetActiveCompanySubscriptionRequest} request
|
|
220
207
|
* @param {Companies.RequestOptions} requestOptions - Request-specific configuration.
|