From 4e395178511623c711873cd1872df549539e175e Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 04:04:06 +0000 Subject: [PATCH] SDK regeneration Unable to analyze changes with AI, incrementing PATCH version. --- .fern/metadata.json | 2 +- .fernignore | 1 + changelog.md | 4 + package.json | 2 +- reference.md | 173 ++++- src/BaseClient.ts | 4 +- src/Client.ts | 6 + src/api/resources/billing/client/Client.ts | 15 +- .../requests/CountBillingProductsRequest.ts | 2 +- .../client/requests/CountCustomersRequest.ts | 2 - .../CreateBillingCustomerRequestBody.ts | 2 - .../requests/ListBillingProductsRequest.ts | 2 +- .../ListCustomersWithSubscriptionsRequest.ts | 2 - .../types/CountBillingProductsParams.ts | 2 +- .../billing/types/CountCustomersParams.ts | 1 - .../types/ListBillingProductsParams.ts | 2 +- .../ListCustomersWithSubscriptionsParams.ts | 1 - src/api/resources/credits/client/Client.ts | 163 +++++ .../requests/CountCompanyGrantsRequest.ts | 23 + .../credits/client/requests/index.ts | 3 +- .../credits/types/CountCompanyGrantsParams.ts | 16 + .../types/CountCompanyGrantsResponse.ts | 9 + src/api/resources/credits/types/index.ts | 2 + src/api/resources/index.ts | 3 + src/api/resources/planbundle/client/Client.ts | 303 +++++++++ src/api/resources/planbundle/client/index.ts | 1 + .../requests/CreatePlanBundleRequestBody.ts | 19 + .../requests/UpdatePlanBundleRequestBody.ts | 19 + .../planbundle/client/requests/index.ts | 2 + src/api/resources/planbundle/index.ts | 2 + .../types/CreatePlanBundleResponse.ts | 9 + .../types/UpdatePlanBundleResponse.ts | 9 + src/api/resources/planbundle/types/index.ts | 2 + .../resources/plans/client/requests/index.ts | 3 - .../types/BillingCreditGrantResponseData.ts | 2 + src/api/types/BillingCustomerResponseData.ts | 1 - ...ngCustomerWithSubscriptionsResponseData.ts | 1 - .../types/CompanyPlanDetailResponseData.ts | 1 + ...CreateBillingPlanCreditGrantRequestBody.ts | 12 +- .../CreateEntitlementInBundleRequestBody.ts | 32 + ...itlementInBundleRequestBodyMetricPeriod.ts | 10 + ...BundleRequestBodyMetricPeriodMonthReset.ts | 8 + .../CreatePlanRequestBody.ts | 10 +- src/api/types/CreditCompanyGrantView.ts | 2 + ...DeleteBillingPlanCreditGrantRequestBody.ts | 5 + src/api/types/EventDetailResponseData.ts | 2 +- src/api/types/EventResponseData.ts | 2 +- src/api/types/PlanBundleAction.ts | 8 + .../types/PlanBundleCreditGrantRequestBody.ts | 11 + .../types/PlanBundleEntitlementRequestBody.ts | 9 + src/api/types/PlanBundleResponseData.ts | 11 + src/api/types/PlanChangeSubscriptionAction.ts | 1 + src/api/types/PlanDetailResponseData.ts | 1 + .../types/PlanGroupPlanDetailResponseData.ts | 1 + src/api/types/PlanVersionResponseData.ts | 17 + src/api/types/PlanVersionStatus.ts | 8 + src/api/types/RawEventResponseData.ts | 2 +- ...UpdateBillingPlanCreditGrantRequestBody.ts | 9 +- .../UpdatePlanRequestBody.ts | 6 - .../UpsertBillingProductRequestBody.ts | 9 +- src/api/types/WebhookRequestType.ts | 2 + src/api/types/index.ts | 15 + .../CreateBillingCustomerRequestBody.ts | 2 - .../billing/types/CountCustomersParams.ts | 2 - .../ListCustomersWithSubscriptionsParams.ts | 2 - .../credits/client/requests/index.ts | 2 - .../credits/types/CountCompanyGrantsParams.ts | 28 + .../types/CountCompanyGrantsResponse.ts | 22 + .../resources/credits/types/index.ts | 2 + src/serialization/resources/index.ts | 3 + .../resources/planbundle/client/index.ts | 1 + .../requests/CreatePlanBundleRequestBody.ts | 34 + .../requests/UpdatePlanBundleRequestBody.ts | 34 + .../planbundle/client/requests/index.ts | 2 + .../resources/planbundle/index.ts | 2 + .../types/CreatePlanBundleResponse.ts | 21 + .../types/UpdatePlanBundleResponse.ts | 21 + .../resources/planbundle/types/index.ts | 2 + .../resources/plans/client/requests/index.ts | 3 - .../types/BillingCreditGrantResponseData.ts | 5 + .../types/BillingCustomerResponseData.ts | 2 - ...ngCustomerWithSubscriptionsResponseData.ts | 2 - .../types/CompanyPlanDetailResponseData.ts | 3 + ...CreateBillingPlanCreditGrantRequestBody.ts | 20 +- .../CreateEntitlementInBundleRequestBody.ts | 105 +++ ...itlementInBundleRequestBodyMetricPeriod.ts | 14 + ...BundleRequestBodyMetricPeriodMonthReset.ts | 14 + .../CreatePlanRequestBody.ts | 10 +- .../types/CreditCompanyGrantView.ts | 5 + ...DeleteBillingPlanCreditGrantRequestBody.ts | 18 + .../types/EventDetailResponseData.ts | 4 +- src/serialization/types/EventResponseData.ts | 4 +- src/serialization/types/PlanBundleAction.ts | 12 + .../types/PlanBundleCreditGrantRequestBody.ts | 30 + .../types/PlanBundleEntitlementRequestBody.ts | 24 + .../types/PlanBundleResponseData.ts | 34 + .../types/PlanChangeSubscriptionAction.ts | 19 +- .../types/PlanDetailResponseData.ts | 3 + .../types/PlanGroupPlanDetailResponseData.ts | 3 + .../types/PlanVersionResponseData.ts | 40 ++ src/serialization/types/PlanVersionStatus.ts | 14 + .../types/RawEventResponseData.ts | 4 +- ...UpdateBillingPlanCreditGrantRequestBody.ts | 20 +- .../UpdatePlanRequestBody.ts | 8 +- .../UpsertBillingProductRequestBody.ts | 10 +- src/serialization/types/WebhookRequestType.ts | 6 +- src/serialization/types/index.ts | 15 + tests/wire/billing.test.ts | 64 +- tests/wire/checkout.test.ts | 84 +++ tests/wire/companies.test.ts | 8 +- tests/wire/components.test.ts | 114 ++++ tests/wire/credits.test.ts | 143 +++++ tests/wire/events.test.ts | 22 +- tests/wire/planbundle.test.ts | 603 ++++++++++++++++++ tests/wire/plangroups.test.ts | 168 +++++ tests/wire/plans.test.ts | 112 ++++ 116 files changed, 2733 insertions(+), 225 deletions(-) create mode 100644 changelog.md create mode 100644 src/api/resources/credits/client/requests/CountCompanyGrantsRequest.ts create mode 100644 src/api/resources/credits/types/CountCompanyGrantsParams.ts create mode 100644 src/api/resources/credits/types/CountCompanyGrantsResponse.ts create mode 100644 src/api/resources/planbundle/client/Client.ts create mode 100644 src/api/resources/planbundle/client/index.ts create mode 100644 src/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts create mode 100644 src/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts create mode 100644 src/api/resources/planbundle/client/requests/index.ts create mode 100644 src/api/resources/planbundle/index.ts create mode 100644 src/api/resources/planbundle/types/CreatePlanBundleResponse.ts create mode 100644 src/api/resources/planbundle/types/UpdatePlanBundleResponse.ts create mode 100644 src/api/resources/planbundle/types/index.ts rename src/api/{resources/credits/client/requests => types}/CreateBillingPlanCreditGrantRequestBody.ts (77%) create mode 100644 src/api/types/CreateEntitlementInBundleRequestBody.ts create mode 100644 src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts create mode 100644 src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts rename src/api/{resources/plans/client/requests => types}/CreatePlanRequestBody.ts (52%) create mode 100644 src/api/types/DeleteBillingPlanCreditGrantRequestBody.ts create mode 100644 src/api/types/PlanBundleAction.ts create mode 100644 src/api/types/PlanBundleCreditGrantRequestBody.ts create mode 100644 src/api/types/PlanBundleEntitlementRequestBody.ts create mode 100644 src/api/types/PlanBundleResponseData.ts create mode 100644 src/api/types/PlanVersionResponseData.ts create mode 100644 src/api/types/PlanVersionStatus.ts rename src/api/{resources/credits/client/requests => types}/UpdateBillingPlanCreditGrantRequestBody.ts (83%) rename src/api/{resources/plans/client/requests => types}/UpdatePlanRequestBody.ts (73%) rename src/api/{resources/plans/client/requests => types}/UpsertBillingProductRequestBody.ts (73%) create mode 100644 src/serialization/resources/credits/types/CountCompanyGrantsParams.ts create mode 100644 src/serialization/resources/credits/types/CountCompanyGrantsResponse.ts create mode 100644 src/serialization/resources/planbundle/client/index.ts create mode 100644 src/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts create mode 100644 src/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts create mode 100644 src/serialization/resources/planbundle/client/requests/index.ts create mode 100644 src/serialization/resources/planbundle/index.ts create mode 100644 src/serialization/resources/planbundle/types/CreatePlanBundleResponse.ts create mode 100644 src/serialization/resources/planbundle/types/UpdatePlanBundleResponse.ts create mode 100644 src/serialization/resources/planbundle/types/index.ts rename src/serialization/{resources/credits/client/requests => types}/CreateBillingPlanCreditGrantRequestBody.ts (80%) create mode 100644 src/serialization/types/CreateEntitlementInBundleRequestBody.ts create mode 100644 src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts create mode 100644 src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts rename src/serialization/{resources/plans/client/requests => types}/CreatePlanRequestBody.ts (67%) create mode 100644 src/serialization/types/DeleteBillingPlanCreditGrantRequestBody.ts create mode 100644 src/serialization/types/PlanBundleAction.ts create mode 100644 src/serialization/types/PlanBundleCreditGrantRequestBody.ts create mode 100644 src/serialization/types/PlanBundleEntitlementRequestBody.ts create mode 100644 src/serialization/types/PlanBundleResponseData.ts create mode 100644 src/serialization/types/PlanVersionResponseData.ts create mode 100644 src/serialization/types/PlanVersionStatus.ts rename src/serialization/{resources/credits/client/requests => types}/UpdateBillingPlanCreditGrantRequestBody.ts (79%) rename src/serialization/{resources/plans/client/requests => types}/UpdatePlanRequestBody.ts (69%) rename src/serialization/{resources/plans/client/requests => types}/UpsertBillingProductRequestBody.ts (89%) create mode 100644 tests/wire/planbundle.test.ts diff --git a/.fern/metadata.json b/.fern/metadata.json index 067eb1d8..48a6294c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -41,5 +41,5 @@ "files": ["dist/**/*.js", "dist/**/*.d.ts", "!dist/**/*.js.map", "!dist/**/*.test.*", "README.md"] } }, - "sdkVersion": "1.3.0" + "sdkVersion": "1.3.1" } diff --git a/.fernignore b/.fernignore index e9e36859..8fe32017 100644 --- a/.fernignore +++ b/.fernignore @@ -17,3 +17,4 @@ src/version.ts src/webhooks.ts src/wrapper.ts tests/unit/webhooks.test.ts +changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 00000000..89f7b8ea --- /dev/null +++ b/changelog.md @@ -0,0 +1,4 @@ +## 1.3.1 - 2026-01-13 +* SDK regeneration +* Unable to analyze changes with AI, incrementing PATCH version. + diff --git a/package.json b/package.json index 1a7081e0..afea1608 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@schematichq/schematic-typescript-node", - "version": "1.3.0", + "version": "1.3.1", "private": false, "repository": { "type": "git", diff --git a/reference.md b/reference.md index 4c0efe4a..ca54b8c9 100644 --- a/reference.md +++ b/reference.md @@ -1000,7 +1000,6 @@ await client.billing.upsertBillingCoupon({ await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { "key": "value" }, @@ -1055,7 +1054,6 @@ await client.billing.upsertBillingCustomer({ ```typescript await client.billing.listCustomersWithSubscriptions({ - failedToImport: true, name: "name", providerType: "schematic", q: "q", @@ -1111,7 +1109,6 @@ await client.billing.listCustomersWithSubscriptions({ ```typescript await client.billing.countCustomers({ - failedToImport: true, name: "name", providerType: "schematic", q: "q", @@ -2758,6 +2755,61 @@ await client.credits.grantBillingCreditsToCompany({ + + + + +
client.credits.countCompanyGrants({ ...params }) -> Schematic.CountCompanyGrantsResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.credits.countCompanyGrants({ + companyId: "company_id", + order: "created_at", + dir: "asc", + limit: 1, + offset: 1 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.CountCompanyGrantsRequest` + +
+
+ +
+
+ +**requestOptions:** `CreditsClient.RequestOptions` + +
+
+
+
+ +
@@ -9162,6 +9214,121 @@ await client.features.countFlags({ + + + + +## planbundle +
client.planbundle.createPlanBundle({ ...params }) -> Schematic.CreatePlanBundleResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.planbundle.createPlanBundle({ + entitlements: [{ + action: "create" + }] +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.CreatePlanBundleRequestBody` + +
+
+ +
+
+ +**requestOptions:** `PlanbundleClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.planbundle.updatePlanBundle(plan_bundle_id, { ...params }) -> Schematic.UpdatePlanBundleResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [{ + action: "create" + }] +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**plan_bundle_id:** `string` — plan_bundle_id + +
+
+ +
+
+ +**request:** `Schematic.UpdatePlanBundleRequestBody` + +
+
+ +
+
+ +**requestOptions:** `PlanbundleClient.RequestOptions` + +
+
+
+
+ +
diff --git a/src/BaseClient.ts b/src/BaseClient.ts index 0a3311c2..467a58d9 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -52,8 +52,8 @@ export function normalizeClientOptions> { - const { companyIds, failedToImport, name, providerType, q, limit, offset } = request; + const { companyIds, name, providerType, q, limit, offset } = request; const _queryParams: Record = {}; if (companyIds != null) { if (Array.isArray(companyIds)) { @@ -496,10 +494,6 @@ export class BillingClient { } } - if (failedToImport != null) { - _queryParams.failed_to_import = failedToImport.toString(); - } - if (name != null) { _queryParams.name = name; } @@ -638,7 +632,6 @@ export class BillingClient { * * @example * await client.billing.countCustomers({ - * failedToImport: true, * name: "name", * providerType: "schematic", * q: "q", @@ -657,7 +650,7 @@ export class BillingClient { request: Schematic.CountCustomersRequest = {}, requestOptions?: BillingClient.RequestOptions, ): Promise> { - const { companyIds, failedToImport, name, providerType, q, limit, offset } = request; + const { companyIds, name, providerType, q, limit, offset } = request; const _queryParams: Record = {}; if (companyIds != null) { if (Array.isArray(companyIds)) { @@ -667,10 +660,6 @@ export class BillingClient { } } - if (failedToImport != null) { - _queryParams.failed_to_import = failedToImport.toString(); - } - if (name != null) { _queryParams.name = name; } diff --git a/src/api/resources/billing/client/requests/CountBillingProductsRequest.ts b/src/api/resources/billing/client/requests/CountBillingProductsRequest.ts index b124a506..f17d758f 100644 --- a/src/api/resources/billing/client/requests/CountBillingProductsRequest.ts +++ b/src/api/resources/billing/client/requests/CountBillingProductsRequest.ts @@ -20,7 +20,7 @@ import type * as Schematic from "../../../../index"; */ export interface CountBillingProductsRequest { ids?: string | string[]; - /** Filter products that are active */ + /** Filter products that are active. Defaults to true if not specified */ isActive?: boolean; name?: string; priceUsageType?: Schematic.BillingPriceUsageType; diff --git a/src/api/resources/billing/client/requests/CountCustomersRequest.ts b/src/api/resources/billing/client/requests/CountCustomersRequest.ts index 7cc93483..e6be6d43 100644 --- a/src/api/resources/billing/client/requests/CountCustomersRequest.ts +++ b/src/api/resources/billing/client/requests/CountCustomersRequest.ts @@ -5,7 +5,6 @@ import type * as Schematic from "../../../../index"; /** * @example * { - * failedToImport: true, * name: "name", * providerType: "schematic", * q: "q", @@ -15,7 +14,6 @@ import type * as Schematic from "../../../../index"; */ export interface CountCustomersRequest { companyIds?: string | string[]; - failedToImport?: boolean; name?: string; providerType?: Schematic.BillingProviderType; q?: string; diff --git a/src/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts b/src/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts index 03ca9a72..773deb88 100644 --- a/src/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts +++ b/src/api/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts @@ -7,7 +7,6 @@ import type * as Schematic from "../../../../index"; * { * email: "email", * externalId: "external_id", - * failedToImport: true, * meta: { * "key": "value" * }, @@ -19,7 +18,6 @@ export interface CreateBillingCustomerRequestBody { defaultPaymentMethodId?: string; email: string; externalId: string; - failedToImport: boolean; meta: Record; name: string; providerType?: Schematic.BillingProviderType; diff --git a/src/api/resources/billing/client/requests/ListBillingProductsRequest.ts b/src/api/resources/billing/client/requests/ListBillingProductsRequest.ts index 3a3b858b..9e8d9b74 100644 --- a/src/api/resources/billing/client/requests/ListBillingProductsRequest.ts +++ b/src/api/resources/billing/client/requests/ListBillingProductsRequest.ts @@ -20,7 +20,7 @@ import type * as Schematic from "../../../../index"; */ export interface ListBillingProductsRequest { ids?: string | string[]; - /** Filter products that are active */ + /** Filter products that are active. Defaults to true if not specified */ isActive?: boolean; name?: string; priceUsageType?: Schematic.BillingPriceUsageType; diff --git a/src/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.ts b/src/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.ts index 1475eb04..79a9b8a2 100644 --- a/src/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.ts +++ b/src/api/resources/billing/client/requests/ListCustomersWithSubscriptionsRequest.ts @@ -5,7 +5,6 @@ import type * as Schematic from "../../../../index"; /** * @example * { - * failedToImport: true, * name: "name", * providerType: "schematic", * q: "q", @@ -15,7 +14,6 @@ import type * as Schematic from "../../../../index"; */ export interface ListCustomersWithSubscriptionsRequest { companyIds?: string | string[]; - failedToImport?: boolean; name?: string; providerType?: Schematic.BillingProviderType; q?: string; diff --git a/src/api/resources/billing/types/CountBillingProductsParams.ts b/src/api/resources/billing/types/CountBillingProductsParams.ts index f64f226b..df12cd04 100644 --- a/src/api/resources/billing/types/CountBillingProductsParams.ts +++ b/src/api/resources/billing/types/CountBillingProductsParams.ts @@ -7,7 +7,7 @@ import type * as Schematic from "../../../index"; */ export interface CountBillingProductsParams { ids?: string[]; - /** Filter products that are active */ + /** Filter products that are active. Defaults to true if not specified */ isActive?: boolean; /** Page limit (default 100) */ limit?: number; diff --git a/src/api/resources/billing/types/CountCustomersParams.ts b/src/api/resources/billing/types/CountCustomersParams.ts index fa5d87d8..cf5bcac5 100644 --- a/src/api/resources/billing/types/CountCustomersParams.ts +++ b/src/api/resources/billing/types/CountCustomersParams.ts @@ -7,7 +7,6 @@ import type * as Schematic from "../../../index"; */ export interface CountCustomersParams { companyIds?: string[]; - failedToImport?: boolean; /** Page limit (default 100) */ limit?: number; name?: string; diff --git a/src/api/resources/billing/types/ListBillingProductsParams.ts b/src/api/resources/billing/types/ListBillingProductsParams.ts index 817d2b70..6329d215 100644 --- a/src/api/resources/billing/types/ListBillingProductsParams.ts +++ b/src/api/resources/billing/types/ListBillingProductsParams.ts @@ -7,7 +7,7 @@ import type * as Schematic from "../../../index"; */ export interface ListBillingProductsParams { ids?: string[]; - /** Filter products that are active */ + /** Filter products that are active. Defaults to true if not specified */ isActive?: boolean; /** Page limit (default 100) */ limit?: number; diff --git a/src/api/resources/billing/types/ListCustomersWithSubscriptionsParams.ts b/src/api/resources/billing/types/ListCustomersWithSubscriptionsParams.ts index f8ca529c..666da40c 100644 --- a/src/api/resources/billing/types/ListCustomersWithSubscriptionsParams.ts +++ b/src/api/resources/billing/types/ListCustomersWithSubscriptionsParams.ts @@ -7,7 +7,6 @@ import type * as Schematic from "../../../index"; */ export interface ListCustomersWithSubscriptionsParams { companyIds?: string[]; - failedToImport?: boolean; /** Page limit (default 100) */ limit?: number; name?: string; diff --git a/src/api/resources/credits/client/Client.ts b/src/api/resources/credits/client/Client.ts index 93197c06..23810a0c 100644 --- a/src/api/resources/credits/client/Client.ts +++ b/src/api/resources/credits/client/Client.ts @@ -2009,6 +2009,169 @@ export class CreditsClient { ); } + /** + * @param {Schematic.CountCompanyGrantsRequest} request + * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.credits.countCompanyGrants({ + * companyId: "company_id", + * order: "created_at", + * dir: "asc", + * limit: 1, + * offset: 1 + * }) + */ + public countCompanyGrants( + request: Schematic.CountCompanyGrantsRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__countCompanyGrants(request, requestOptions)); + } + + private async __countCompanyGrants( + request: Schematic.CountCompanyGrantsRequest = {}, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { companyId, order, dir, limit, offset } = request; + const _queryParams: Record = {}; + if (companyId != null) { + _queryParams.company_id = companyId; + } + + if (order != null) { + _queryParams.order = serializers.CreditGrantSortOrder.jsonOrThrow(order, { + unrecognizedObjectKeys: "strip", + }); + } + + if (dir != null) { + _queryParams.dir = serializers.SortDirection.jsonOrThrow(dir, { unrecognizedObjectKeys: "strip" }); + } + + if (limit != null) { + _queryParams.limit = limit.toString(); + } + + if (offset != null) { + _queryParams.offset = offset.toString(); + } + + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "billing/credits/grants/company/count", + ), + method: "GET", + headers: _headers, + queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.CountCompanyGrantsResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "GET", + "/billing/credits/grants/company/count", + ); + } + /** * @param {Schematic.ListCompanyGrantsRequest} request * @param {CreditsClient.RequestOptions} requestOptions - Request-specific configuration. diff --git a/src/api/resources/credits/client/requests/CountCompanyGrantsRequest.ts b/src/api/resources/credits/client/requests/CountCompanyGrantsRequest.ts new file mode 100644 index 00000000..ef05481b --- /dev/null +++ b/src/api/resources/credits/client/requests/CountCompanyGrantsRequest.ts @@ -0,0 +1,23 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * companyId: "company_id", + * order: "created_at", + * dir: "asc", + * limit: 1, + * offset: 1 + * } + */ +export interface CountCompanyGrantsRequest { + companyId?: string; + order?: Schematic.CreditGrantSortOrder; + dir?: Schematic.SortDirection; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/credits/client/requests/index.ts b/src/api/resources/credits/client/requests/index.ts index 4eca8af1..e044f025 100644 --- a/src/api/resources/credits/client/requests/index.ts +++ b/src/api/resources/credits/client/requests/index.ts @@ -1,10 +1,10 @@ export type { CountBillingCreditsGrantsRequest } from "./CountBillingCreditsGrantsRequest"; export type { CountBillingCreditsRequest } from "./CountBillingCreditsRequest"; export type { CountBillingPlanCreditGrantsRequest } from "./CountBillingPlanCreditGrantsRequest"; +export type { CountCompanyGrantsRequest } from "./CountCompanyGrantsRequest"; export type { CountCreditBundlesRequest } from "./CountCreditBundlesRequest"; export type { CountCreditLedgerRequest } from "./CountCreditLedgerRequest"; export type { CreateBillingCreditRequestBody } from "./CreateBillingCreditRequestBody"; -export type { CreateBillingPlanCreditGrantRequestBody } from "./CreateBillingPlanCreditGrantRequestBody"; export type { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant"; export type { CreateCreditBundleRequestBody } from "./CreateCreditBundleRequestBody"; export type { DeleteBillingPlanCreditGrantRequest } from "./DeleteBillingPlanCreditGrantRequest"; @@ -15,6 +15,5 @@ export type { ListCompanyGrantsRequest } from "./ListCompanyGrantsRequest"; export type { ListCreditBundlesRequest } from "./ListCreditBundlesRequest"; export type { ListGrantsForCreditRequest } from "./ListGrantsForCreditRequest"; export type { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody"; -export type { UpdateBillingPlanCreditGrantRequestBody } from "./UpdateBillingPlanCreditGrantRequestBody"; export type { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody"; export type { ZeroOutGrantRequestBody } from "./ZeroOutGrantRequestBody"; diff --git a/src/api/resources/credits/types/CountCompanyGrantsParams.ts b/src/api/resources/credits/types/CountCompanyGrantsParams.ts new file mode 100644 index 00000000..51b8d45c --- /dev/null +++ b/src/api/resources/credits/types/CountCompanyGrantsParams.ts @@ -0,0 +1,16 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface CountCompanyGrantsParams { + companyId?: string; + dir?: Schematic.SortDirection; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + order?: Schematic.CreditGrantSortOrder; +} diff --git a/src/api/resources/credits/types/CountCompanyGrantsResponse.ts b/src/api/resources/credits/types/CountCompanyGrantsResponse.ts new file mode 100644 index 00000000..afcd267c --- /dev/null +++ b/src/api/resources/credits/types/CountCompanyGrantsResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface CountCompanyGrantsResponse { + data: Schematic.CountResponse; + /** Input parameters */ + params: Schematic.CountCompanyGrantsParams; +} diff --git a/src/api/resources/credits/types/index.ts b/src/api/resources/credits/types/index.ts index 20c740d9..96af477d 100644 --- a/src/api/resources/credits/types/index.ts +++ b/src/api/resources/credits/types/index.ts @@ -4,6 +4,8 @@ export * from "./CountBillingCreditsParams"; export * from "./CountBillingCreditsResponse"; export * from "./CountBillingPlanCreditGrantsParams"; export * from "./CountBillingPlanCreditGrantsResponse"; +export * from "./CountCompanyGrantsParams"; +export * from "./CountCompanyGrantsResponse"; export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; export * from "./CountCreditLedgerParams"; diff --git a/src/api/resources/index.ts b/src/api/resources/index.ts index b5c38649..5564974c 100644 --- a/src/api/resources/index.ts +++ b/src/api/resources/index.ts @@ -31,6 +31,9 @@ export * from "./events/types"; export * as features from "./features"; export * from "./features/client/requests"; export * from "./features/types"; +export * as planbundle from "./planbundle"; +export * from "./planbundle/client/requests"; +export * from "./planbundle/types"; export * as plangroups from "./plangroups"; export * from "./plangroups/client/requests"; export * from "./plangroups/types"; diff --git a/src/api/resources/planbundle/client/Client.ts b/src/api/resources/planbundle/client/Client.ts new file mode 100644 index 00000000..12d00759 --- /dev/null +++ b/src/api/resources/planbundle/client/Client.ts @@ -0,0 +1,303 @@ +// This file was auto-generated by Fern from our API Definition. + +import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient"; +import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient"; +import * as core from "../../../../core"; +import { mergeHeaders } from "../../../../core/headers"; +import * as environments from "../../../../environments"; +import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError"; +import * as errors from "../../../../errors/index"; +import * as serializers from "../../../../serialization/index"; +import * as Schematic from "../../../index"; + +export declare namespace PlanbundleClient { + export type Options = BaseClientOptions; + + export interface RequestOptions extends BaseRequestOptions {} +} + +export class PlanbundleClient { + protected readonly _options: NormalizedClientOptionsWithAuth; + + constructor(options: PlanbundleClient.Options) { + this._options = normalizeClientOptionsWithAuth(options); + } + + /** + * @param {Schematic.CreatePlanBundleRequestBody} request + * @param {PlanbundleClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.planbundle.createPlanBundle({ + * entitlements: [{ + * action: "create" + * }] + * }) + */ + public createPlanBundle( + request: Schematic.CreatePlanBundleRequestBody, + requestOptions?: PlanbundleClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__createPlanBundle(request, requestOptions)); + } + + private async __createPlanBundle( + request: Schematic.CreatePlanBundleRequestBody, + requestOptions?: PlanbundleClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + "plan-bundles", + ), + method: "POST", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.CreatePlanBundleRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.CreatePlanBundleResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/plan-bundles"); + } + + /** + * @param {string} plan_bundle_id - plan_bundle_id + * @param {Schematic.UpdatePlanBundleRequestBody} request + * @param {PlanbundleClient.RequestOptions} requestOptions - Request-specific configuration. + * + * @throws {@link Schematic.BadRequestError} + * @throws {@link Schematic.UnauthorizedError} + * @throws {@link Schematic.ForbiddenError} + * @throws {@link Schematic.NotFoundError} + * @throws {@link Schematic.InternalServerError} + * + * @example + * await client.planbundle.updatePlanBundle("plan_bundle_id", { + * entitlements: [{ + * action: "create" + * }] + * }) + */ + public updatePlanBundle( + plan_bundle_id: string, + request: Schematic.UpdatePlanBundleRequestBody, + requestOptions?: PlanbundleClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__updatePlanBundle(plan_bundle_id, request, requestOptions)); + } + + private async __updatePlanBundle( + plan_bundle_id: string, + request: Schematic.UpdatePlanBundleRequestBody, + requestOptions?: PlanbundleClient.RequestOptions, + ): Promise> { + const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); + const _headers: core.Fetcher.Args["headers"] = mergeHeaders( + _authRequest.headers, + this._options?.headers, + requestOptions?.headers, + ); + const _response = await (this._options.fetcher ?? core.fetcher)({ + url: core.url.join( + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.SchematicEnvironment.Default, + `plan-bundles/${core.url.encodePathParam(plan_bundle_id)}`, + ), + method: "PUT", + headers: _headers, + contentType: "application/json", + queryParameters: requestOptions?.queryParams, + requestType: "json", + body: serializers.UpdatePlanBundleRequestBody.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }), + timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000, + maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, + abortSignal: requestOptions?.abortSignal, + fetchFn: this._options?.fetch, + logging: this._options.logging, + }); + if (_response.ok) { + return { + data: serializers.UpdatePlanBundleResponse.parseOrThrow(_response.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + rawResponse: _response.rawResponse, + }; + } + + if (_response.error.reason === "status-code") { + switch (_response.error.statusCode) { + case 400: + throw new Schematic.BadRequestError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 401: + throw new Schematic.UnauthorizedError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 403: + throw new Schematic.ForbiddenError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 404: + throw new Schematic.NotFoundError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + case 500: + throw new Schematic.InternalServerError( + serializers.ApiError.parseOrThrow(_response.error.body, { + unrecognizedObjectKeys: "passthrough", + allowUnrecognizedUnionMembers: true, + allowUnrecognizedEnumValues: true, + skipValidation: true, + breadcrumbsPrefix: ["response"], + }), + _response.rawResponse, + ); + default: + throw new errors.SchematicError({ + statusCode: _response.error.statusCode, + body: _response.error.body, + rawResponse: _response.rawResponse, + }); + } + } + + return handleNonStatusCodeError( + _response.error, + _response.rawResponse, + "PUT", + "/plan-bundles/{plan_bundle_id}", + ); + } +} diff --git a/src/api/resources/planbundle/client/index.ts b/src/api/resources/planbundle/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/api/resources/planbundle/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts b/src/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts new file mode 100644 index 00000000..6a314ceb --- /dev/null +++ b/src/api/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * entitlements: [{ + * action: "create" + * }] + * } + */ +export interface CreatePlanBundleRequestBody { + billingProduct?: Schematic.UpsertBillingProductRequestBody; + creditGrants?: Schematic.PlanBundleCreditGrantRequestBody[]; + entitlements: Schematic.PlanBundleEntitlementRequestBody[]; + plan?: Schematic.CreatePlanRequestBody; + traits?: Schematic.UpdatePlanTraitTraitRequestBody[]; +} diff --git a/src/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts b/src/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts new file mode 100644 index 00000000..4e752a83 --- /dev/null +++ b/src/api/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * entitlements: [{ + * action: "create" + * }] + * } + */ +export interface UpdatePlanBundleRequestBody { + billingProduct?: Schematic.UpsertBillingProductRequestBody; + creditGrants?: Schematic.PlanBundleCreditGrantRequestBody[]; + entitlements: Schematic.PlanBundleEntitlementRequestBody[]; + plan?: Schematic.UpdatePlanRequestBody; + traits?: Schematic.UpdatePlanTraitTraitRequestBody[]; +} diff --git a/src/api/resources/planbundle/client/requests/index.ts b/src/api/resources/planbundle/client/requests/index.ts new file mode 100644 index 00000000..98c457e6 --- /dev/null +++ b/src/api/resources/planbundle/client/requests/index.ts @@ -0,0 +1,2 @@ +export type { CreatePlanBundleRequestBody } from "./CreatePlanBundleRequestBody"; +export type { UpdatePlanBundleRequestBody } from "./UpdatePlanBundleRequestBody"; diff --git a/src/api/resources/planbundle/index.ts b/src/api/resources/planbundle/index.ts new file mode 100644 index 00000000..d2ec2302 --- /dev/null +++ b/src/api/resources/planbundle/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./types"; diff --git a/src/api/resources/planbundle/types/CreatePlanBundleResponse.ts b/src/api/resources/planbundle/types/CreatePlanBundleResponse.ts new file mode 100644 index 00000000..76ae1a7f --- /dev/null +++ b/src/api/resources/planbundle/types/CreatePlanBundleResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface CreatePlanBundleResponse { + data: Schematic.PlanBundleResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/planbundle/types/UpdatePlanBundleResponse.ts b/src/api/resources/planbundle/types/UpdatePlanBundleResponse.ts new file mode 100644 index 00000000..8ebb5df0 --- /dev/null +++ b/src/api/resources/planbundle/types/UpdatePlanBundleResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface UpdatePlanBundleResponse { + data: Schematic.PlanBundleResponseData; + /** Input parameters */ + params: Record; +} diff --git a/src/api/resources/planbundle/types/index.ts b/src/api/resources/planbundle/types/index.ts new file mode 100644 index 00000000..d7effde9 --- /dev/null +++ b/src/api/resources/planbundle/types/index.ts @@ -0,0 +1,2 @@ +export * from "./CreatePlanBundleResponse"; +export * from "./UpdatePlanBundleResponse"; diff --git a/src/api/resources/plans/client/requests/index.ts b/src/api/resources/plans/client/requests/index.ts index b669fda7..2a2494c8 100644 --- a/src/api/resources/plans/client/requests/index.ts +++ b/src/api/resources/plans/client/requests/index.ts @@ -1,7 +1,4 @@ export type { CountPlansRequest } from "./CountPlansRequest"; -export type { CreatePlanRequestBody } from "./CreatePlanRequestBody"; export type { ListPlanIssuesRequest } from "./ListPlanIssuesRequest"; export type { ListPlansRequest } from "./ListPlansRequest"; export type { UpdateCompanyPlansRequestBody } from "./UpdateCompanyPlansRequestBody"; -export type { UpdatePlanRequestBody } from "./UpdatePlanRequestBody"; -export type { UpsertBillingProductRequestBody } from "./UpsertBillingProductRequestBody"; diff --git a/src/api/types/BillingCreditGrantResponseData.ts b/src/api/types/BillingCreditGrantResponseData.ts index 7a6df259..5f1581e7 100644 --- a/src/api/types/BillingCreditGrantResponseData.ts +++ b/src/api/types/BillingCreditGrantResponseData.ts @@ -18,6 +18,8 @@ export interface BillingCreditGrantResponseData { quantity: number; quantityRemaining: number; quantityUsed: number; + renewalEnabled: boolean; + renewalPeriod?: Schematic.BillingPlanCreditGrantResetCadence; sourceLabel: string; transfers?: Schematic.CreditTransferResponseData[]; updatedAt: Date; diff --git a/src/api/types/BillingCustomerResponseData.ts b/src/api/types/BillingCustomerResponseData.ts index c747a3db..9ebc807e 100644 --- a/src/api/types/BillingCustomerResponseData.ts +++ b/src/api/types/BillingCustomerResponseData.ts @@ -7,7 +7,6 @@ export interface BillingCustomerResponseData { deletedAt?: Date; email: string; externalId: string; - failedToImport: boolean; id: string; name: string; providerType: Schematic.BillingProviderType; diff --git a/src/api/types/BillingCustomerWithSubscriptionsResponseData.ts b/src/api/types/BillingCustomerWithSubscriptionsResponseData.ts index 94277958..ccefa635 100644 --- a/src/api/types/BillingCustomerWithSubscriptionsResponseData.ts +++ b/src/api/types/BillingCustomerWithSubscriptionsResponseData.ts @@ -7,7 +7,6 @@ export interface BillingCustomerWithSubscriptionsResponseData { deletedAt?: Date; email: string; externalId: string; - failedToImport: boolean; id: string; name: string; providerType: Schematic.BillingProviderType; diff --git a/src/api/types/CompanyPlanDetailResponseData.ts b/src/api/types/CompanyPlanDetailResponseData.ts index 806e6ada..b87d0d22 100644 --- a/src/api/types/CompanyPlanDetailResponseData.ts +++ b/src/api/types/CompanyPlanDetailResponseData.ts @@ -33,5 +33,6 @@ export interface CompanyPlanDetailResponseData { updatedAt: Date; usageViolations: Schematic.FeatureUsageResponseData[]; valid: boolean; + versions: Schematic.PlanVersionResponseData[]; yearlyPrice?: Schematic.BillingPriceResponseData; } diff --git a/src/api/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts b/src/api/types/CreateBillingPlanCreditGrantRequestBody.ts similarity index 77% rename from src/api/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts rename to src/api/types/CreateBillingPlanCreditGrantRequestBody.ts index 83b715cd..bbcda5e6 100644 --- a/src/api/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts +++ b/src/api/types/CreateBillingPlanCreditGrantRequestBody.ts @@ -1,17 +1,7 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../index"; +import type * as Schematic from "../index"; -/** - * @example - * { - * creditAmount: 1, - * creditId: "credit_id", - * planId: "plan_id", - * resetCadence: "daily", - * resetStart: "billing_period" - * } - */ export interface CreateBillingPlanCreditGrantRequestBody { applyToExisting?: boolean; autoTopupAmount?: number; diff --git a/src/api/types/CreateEntitlementInBundleRequestBody.ts b/src/api/types/CreateEntitlementInBundleRequestBody.ts new file mode 100644 index 00000000..2e127421 --- /dev/null +++ b/src/api/types/CreateEntitlementInBundleRequestBody.ts @@ -0,0 +1,32 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CreateEntitlementInBundleRequestBody { + billingProductId?: string; + billingThreshold?: number; + creditConsumptionRate?: number; + currency?: string; + featureId: string; + metricPeriod?: Schematic.CreateEntitlementInBundleRequestBodyMetricPeriod; + metricPeriodMonthReset?: Schematic.CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset; + monthlyMeteredPriceId?: string; + monthlyPriceTiers?: Schematic.CreatePriceTierRequestBody[]; + monthlyUnitPrice?: number; + monthlyUnitPriceDecimal?: string; + overageBillingProductId?: string; + priceBehavior?: Schematic.EntitlementPriceBehavior; + /** Use MonthlyPriceTiers or YearlyPriceTiers instead */ + priceTiers?: Schematic.CreatePriceTierRequestBody[]; + softLimit?: number; + tierMode?: Schematic.BillingTiersMode; + valueBool?: boolean; + valueCreditId?: string; + valueNumeric?: number; + valueTraitId?: string; + valueType: Schematic.EntitlementValueType; + yearlyMeteredPriceId?: string; + yearlyPriceTiers?: Schematic.CreatePriceTierRequestBody[]; + yearlyUnitPrice?: number; + yearlyUnitPriceDecimal?: string; +} diff --git a/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts b/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts new file mode 100644 index 00000000..a9f8bfb1 --- /dev/null +++ b/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +export const CreateEntitlementInBundleRequestBodyMetricPeriod = { + AllTime: "all_time", + CurrentMonth: "current_month", + CurrentWeek: "current_week", + CurrentDay: "current_day", +} as const; +export type CreateEntitlementInBundleRequestBodyMetricPeriod = + (typeof CreateEntitlementInBundleRequestBodyMetricPeriod)[keyof typeof CreateEntitlementInBundleRequestBodyMetricPeriod]; diff --git a/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts b/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts new file mode 100644 index 00000000..74a6db2f --- /dev/null +++ b/src/api/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export const CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset = { + FirstOfMonth: "first_of_month", + BillingCycle: "billing_cycle", +} as const; +export type CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset = + (typeof CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset)[keyof typeof CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset]; diff --git a/src/api/resources/plans/client/requests/CreatePlanRequestBody.ts b/src/api/types/CreatePlanRequestBody.ts similarity index 52% rename from src/api/resources/plans/client/requests/CreatePlanRequestBody.ts rename to src/api/types/CreatePlanRequestBody.ts index a51c79cc..5784f802 100644 --- a/src/api/resources/plans/client/requests/CreatePlanRequestBody.ts +++ b/src/api/types/CreatePlanRequestBody.ts @@ -1,15 +1,7 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../index"; +import type * as Schematic from "../index"; -/** - * @example - * { - * description: "description", - * name: "name", - * planType: "plan" - * } - */ export interface CreatePlanRequestBody { description: string; icon?: string; diff --git a/src/api/types/CreditCompanyGrantView.ts b/src/api/types/CreditCompanyGrantView.ts index 34bf9ddb..b00c31be 100644 --- a/src/api/types/CreditCompanyGrantView.ts +++ b/src/api/types/CreditCompanyGrantView.ts @@ -25,6 +25,8 @@ export interface CreditCompanyGrantView { quantity: number; quantityRemaining: number; quantityUsed: number; + renewalEnabled: boolean; + renewalPeriod?: Schematic.BillingPlanCreditGrantResetCadence; singularName?: string; sourceLabel: string; transfers?: Schematic.CreditTransferView[]; diff --git a/src/api/types/DeleteBillingPlanCreditGrantRequestBody.ts b/src/api/types/DeleteBillingPlanCreditGrantRequestBody.ts new file mode 100644 index 00000000..3112d2c0 --- /dev/null +++ b/src/api/types/DeleteBillingPlanCreditGrantRequestBody.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export interface DeleteBillingPlanCreditGrantRequestBody { + applyToExisting?: boolean; +} diff --git a/src/api/types/EventDetailResponseData.ts b/src/api/types/EventDetailResponseData.ts index cdf843ef..77c751a1 100644 --- a/src/api/types/EventDetailResponseData.ts +++ b/src/api/types/EventDetailResponseData.ts @@ -22,7 +22,7 @@ export interface EventDetailResponseData { status: Schematic.EventStatus; subtype?: string; type: Schematic.EventType; - updatedAt: Date; + updatedAt?: Date; user?: Schematic.PreviewObject; userId?: string; } diff --git a/src/api/types/EventResponseData.ts b/src/api/types/EventResponseData.ts index 63664ddd..b2eab487 100644 --- a/src/api/types/EventResponseData.ts +++ b/src/api/types/EventResponseData.ts @@ -20,6 +20,6 @@ export interface EventResponseData { status: Schematic.EventStatus; subtype?: string; type: Schematic.EventType; - updatedAt: Date; + updatedAt?: Date; userId?: string; } diff --git a/src/api/types/PlanBundleAction.ts b/src/api/types/PlanBundleAction.ts new file mode 100644 index 00000000..cf2e9064 --- /dev/null +++ b/src/api/types/PlanBundleAction.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export const PlanBundleAction = { + Create: "create", + Update: "update", + Delete: "delete", +} as const; +export type PlanBundleAction = (typeof PlanBundleAction)[keyof typeof PlanBundleAction]; diff --git a/src/api/types/PlanBundleCreditGrantRequestBody.ts b/src/api/types/PlanBundleCreditGrantRequestBody.ts new file mode 100644 index 00000000..38e52a06 --- /dev/null +++ b/src/api/types/PlanBundleCreditGrantRequestBody.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface PlanBundleCreditGrantRequestBody { + action: Schematic.PlanBundleAction; + createReq?: Schematic.CreateBillingPlanCreditGrantRequestBody; + creditGrantId?: string; + deleteReq?: Schematic.DeleteBillingPlanCreditGrantRequestBody; + updateReq?: Schematic.UpdateBillingPlanCreditGrantRequestBody; +} diff --git a/src/api/types/PlanBundleEntitlementRequestBody.ts b/src/api/types/PlanBundleEntitlementRequestBody.ts new file mode 100644 index 00000000..9dcbf5f7 --- /dev/null +++ b/src/api/types/PlanBundleEntitlementRequestBody.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface PlanBundleEntitlementRequestBody { + action: Schematic.PlanBundleAction; + entitlementId?: string; + req?: Schematic.CreateEntitlementInBundleRequestBody; +} diff --git a/src/api/types/PlanBundleResponseData.ts b/src/api/types/PlanBundleResponseData.ts new file mode 100644 index 00000000..8b6937b8 --- /dev/null +++ b/src/api/types/PlanBundleResponseData.ts @@ -0,0 +1,11 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface PlanBundleResponseData { + billingProduct?: Schematic.BillingProductPlanResponseData; + creditGrants?: Schematic.BillingPlanCreditGrantResponseData[]; + entitlements?: Schematic.PlanEntitlementResponseData[]; + plan?: Schematic.PlanResponseData; + traits?: Schematic.PlanTraitResponseData[]; +} diff --git a/src/api/types/PlanChangeSubscriptionAction.ts b/src/api/types/PlanChangeSubscriptionAction.ts index c1f3f001..e8a9068c 100644 --- a/src/api/types/PlanChangeSubscriptionAction.ts +++ b/src/api/types/PlanChangeSubscriptionAction.ts @@ -1,6 +1,7 @@ // This file was auto-generated by Fern from our API Definition. export const PlanChangeSubscriptionAction = { + Adjustment: "adjustment", Downgrade: "downgrade", Invalid: "invalid", Subscribe: "subscribe", diff --git a/src/api/types/PlanDetailResponseData.ts b/src/api/types/PlanDetailResponseData.ts index 72e88372..fdb8eda0 100644 --- a/src/api/types/PlanDetailResponseData.ts +++ b/src/api/types/PlanDetailResponseData.ts @@ -23,5 +23,6 @@ export interface PlanDetailResponseData { planType: Schematic.PlanType; trialDays?: number; updatedAt: Date; + versions: Schematic.PlanVersionResponseData[]; yearlyPrice?: Schematic.BillingPriceResponseData; } diff --git a/src/api/types/PlanGroupPlanDetailResponseData.ts b/src/api/types/PlanGroupPlanDetailResponseData.ts index 3f367190..dd8da848 100644 --- a/src/api/types/PlanGroupPlanDetailResponseData.ts +++ b/src/api/types/PlanGroupPlanDetailResponseData.ts @@ -27,5 +27,6 @@ export interface PlanGroupPlanDetailResponseData { planType: Schematic.PlanType; trialDays?: number; updatedAt: Date; + versions: Schematic.PlanVersionResponseData[]; yearlyPrice?: Schematic.BillingPriceResponseData; } diff --git a/src/api/types/PlanVersionResponseData.ts b/src/api/types/PlanVersionResponseData.ts new file mode 100644 index 00000000..9cf67672 --- /dev/null +++ b/src/api/types/PlanVersionResponseData.ts @@ -0,0 +1,17 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface PlanVersionResponseData { + createdAt: Date; + description: string; + environmentId: string; + icon: string; + id: string; + name: string; + originalPlanId?: string; + planType: Schematic.PlanType; + status: Schematic.PlanVersionStatus; + updatedAt: Date; + version: number; +} diff --git a/src/api/types/PlanVersionStatus.ts b/src/api/types/PlanVersionStatus.ts new file mode 100644 index 00000000..dcb4f285 --- /dev/null +++ b/src/api/types/PlanVersionStatus.ts @@ -0,0 +1,8 @@ +// This file was auto-generated by Fern from our API Definition. + +export const PlanVersionStatus = { + Published: "published", + Draft: "draft", + Archived: "archived", +} as const; +export type PlanVersionStatus = (typeof PlanVersionStatus)[keyof typeof PlanVersionStatus]; diff --git a/src/api/types/RawEventResponseData.ts b/src/api/types/RawEventResponseData.ts index 75a9d2c8..46777aa3 100644 --- a/src/api/types/RawEventResponseData.ts +++ b/src/api/types/RawEventResponseData.ts @@ -3,7 +3,7 @@ export interface RawEventResponseData { capturedAt: Date; eventId?: string; - remoteAddr: string; + remoteAddr?: string; remoteIp: string; userAgent: string; } diff --git a/src/api/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts b/src/api/types/UpdateBillingPlanCreditGrantRequestBody.ts similarity index 83% rename from src/api/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts rename to src/api/types/UpdateBillingPlanCreditGrantRequestBody.ts index 70865aae..d8b20a61 100644 --- a/src/api/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts +++ b/src/api/types/UpdateBillingPlanCreditGrantRequestBody.ts @@ -1,14 +1,7 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../index"; +import type * as Schematic from "../index"; -/** - * @example - * { - * resetCadence: "daily", - * resetStart: "billing_period" - * } - */ export interface UpdateBillingPlanCreditGrantRequestBody { applyToExisting?: boolean; autoTopupAmount?: number; diff --git a/src/api/resources/plans/client/requests/UpdatePlanRequestBody.ts b/src/api/types/UpdatePlanRequestBody.ts similarity index 73% rename from src/api/resources/plans/client/requests/UpdatePlanRequestBody.ts rename to src/api/types/UpdatePlanRequestBody.ts index 4cde79a6..2a14e523 100644 --- a/src/api/resources/plans/client/requests/UpdatePlanRequestBody.ts +++ b/src/api/types/UpdatePlanRequestBody.ts @@ -1,11 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * @example - * { - * name: "name" - * } - */ export interface UpdatePlanRequestBody { description?: string; icon?: string; diff --git a/src/api/resources/plans/client/requests/UpsertBillingProductRequestBody.ts b/src/api/types/UpsertBillingProductRequestBody.ts similarity index 73% rename from src/api/resources/plans/client/requests/UpsertBillingProductRequestBody.ts rename to src/api/types/UpsertBillingProductRequestBody.ts index a62568ce..c581ed5d 100644 --- a/src/api/resources/plans/client/requests/UpsertBillingProductRequestBody.ts +++ b/src/api/types/UpsertBillingProductRequestBody.ts @@ -1,14 +1,7 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../index"; +import type * as Schematic from "../index"; -/** - * @example - * { - * chargeType: "free", - * isTrialable: true - * } - */ export interface UpsertBillingProductRequestBody { billingProductId?: string; chargeType: Schematic.ChargeType; diff --git a/src/api/types/WebhookRequestType.ts b/src/api/types/WebhookRequestType.ts index 3088924e..7d04a109 100644 --- a/src/api/types/WebhookRequestType.ts +++ b/src/api/types/WebhookRequestType.ts @@ -36,5 +36,7 @@ export const WebhookRequestType = { UserCreated: "user.created", UserDeleted: "user.deleted", UserUpdated: "user.updated", + AutoTopupHardFailure: "auto.topup.hard.failure", + AutoTopupRetryExceeded: "auto.topup.retry.exceeded", } as const; export type WebhookRequestType = (typeof WebhookRequestType)[keyof typeof WebhookRequestType]; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 784ea32a..08e8d434 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -87,7 +87,11 @@ export * from "./ConditionMetricPeriodMonthReset"; export * from "./ConditionOperator"; export * from "./CountResponse"; export * from "./CouponRequestBody"; +export * from "./CreateBillingPlanCreditGrantRequestBody"; export * from "./CreateBillingPriceTierRequestBody"; +export * from "./CreateEntitlementInBundleRequestBody"; +export * from "./CreateEntitlementInBundleRequestBodyMetricPeriod"; +export * from "./CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset"; export * from "./CreateEntitlementReqCommon"; export * from "./CreateEntitlementReqCommonMetricPeriod"; export * from "./CreateEntitlementReqCommonMetricPeriodMonthReset"; @@ -102,6 +106,7 @@ export * from "./CreateOrUpdateConditionRequestBodyOperator"; export * from "./CreateOrUpdateFlagRequestBody"; export * from "./CreateOrUpdateRuleRequestBody"; export * from "./CreateOrUpdateRuleRequestBodyRuleType"; +export * from "./CreatePlanRequestBody"; export * from "./CreatePriceTierRequestBody"; export * from "./CreditAutoTopupAmountType"; export * from "./CreditBundlePurchaseResponseData"; @@ -123,6 +128,7 @@ export * from "./DataExportOutputFileType"; export * from "./DataExportResponseData"; export * from "./DataExportStatus"; export * from "./DataExportType"; +export * from "./DeleteBillingPlanCreditGrantRequestBody"; export * from "./DeleteResponse"; export * from "./DuplicatePlanEntitlementsResponseResponseData"; export * from "./EntitlementPriceBehavior"; @@ -176,6 +182,10 @@ export * from "./MeterRequestBody"; export * from "./OrderedPlansInGroup"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; +export * from "./PlanBundleAction"; +export * from "./PlanBundleCreditGrantRequestBody"; +export * from "./PlanBundleEntitlementRequestBody"; +export * from "./PlanBundleResponseData"; export * from "./PlanChangeAction"; export * from "./PlanChangeActorType"; export * from "./PlanChangeBasePlanAction"; @@ -197,6 +207,8 @@ export * from "./PlanSelection"; export * from "./PlanSnapshotView"; export * from "./PlanTraitResponseData"; export * from "./PlanType"; +export * from "./PlanVersionResponseData"; +export * from "./PlanVersionStatus"; export * from "./PreviewObject"; export * from "./PreviewObjectResponseData"; export * from "./PreviewSubscriptionChangeResponseData"; @@ -252,13 +264,16 @@ export * from "./TraitDefinition"; export * from "./TraitDefinitionComparableType"; export * from "./TraitType"; export * from "./UpdateAddOnRequestBody"; +export * from "./UpdateBillingPlanCreditGrantRequestBody"; export * from "./UpdateCreditBundleRequestBody"; export * from "./UpdateEntitlementReqCommon"; export * from "./UpdateEntitlementReqCommonMetricPeriod"; export * from "./UpdateEntitlementReqCommonMetricPeriodMonthReset"; export * from "./UpdatePayInAdvanceRequestBody"; +export * from "./UpdatePlanRequestBody"; export * from "./UpdatePlanTraitTraitRequestBody"; export * from "./UpdateRuleRequestBody"; +export * from "./UpsertBillingProductRequestBody"; export * from "./UpsertCompanyRequestBody"; export * from "./UpsertTraitRequestBody"; export * from "./UpsertUserRequestBody"; diff --git a/src/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts b/src/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts index 223f39ae..d4aa9b24 100644 --- a/src/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts +++ b/src/serialization/resources/billing/client/requests/CreateBillingCustomerRequestBody.ts @@ -16,7 +16,6 @@ export const CreateBillingCustomerRequestBody: core.serialization.Schema< ), email: core.serialization.string(), externalId: core.serialization.property("external_id", core.serialization.string()), - failedToImport: core.serialization.property("failed_to_import", core.serialization.boolean()), meta: core.serialization.record(core.serialization.string(), core.serialization.string()), name: core.serialization.string(), providerType: core.serialization.property("provider_type", BillingProviderType.optional()), @@ -28,7 +27,6 @@ export declare namespace CreateBillingCustomerRequestBody { default_payment_method_id?: string | null; email: string; external_id: string; - failed_to_import: boolean; meta: Record; name: string; provider_type?: BillingProviderType.Raw | null; diff --git a/src/serialization/resources/billing/types/CountCustomersParams.ts b/src/serialization/resources/billing/types/CountCustomersParams.ts index 441c2dfb..38ea18c7 100644 --- a/src/serialization/resources/billing/types/CountCustomersParams.ts +++ b/src/serialization/resources/billing/types/CountCustomersParams.ts @@ -13,7 +13,6 @@ export const CountCustomersParams: core.serialization.ObjectSchema< "company_ids", core.serialization.list(core.serialization.string()).optional(), ), - failedToImport: core.serialization.property("failed_to_import", core.serialization.boolean().optional()), limit: core.serialization.number().optional(), name: core.serialization.string().optional(), offset: core.serialization.number().optional(), @@ -24,7 +23,6 @@ export const CountCustomersParams: core.serialization.ObjectSchema< export declare namespace CountCustomersParams { export interface Raw { company_ids?: string[] | null; - failed_to_import?: boolean | null; limit?: number | null; name?: string | null; offset?: number | null; diff --git a/src/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.ts b/src/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.ts index 3d73be7c..6e28f92e 100644 --- a/src/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.ts +++ b/src/serialization/resources/billing/types/ListCustomersWithSubscriptionsParams.ts @@ -13,7 +13,6 @@ export const ListCustomersWithSubscriptionsParams: core.serialization.ObjectSche "company_ids", core.serialization.list(core.serialization.string()).optional(), ), - failedToImport: core.serialization.property("failed_to_import", core.serialization.boolean().optional()), limit: core.serialization.number().optional(), name: core.serialization.string().optional(), offset: core.serialization.number().optional(), @@ -24,7 +23,6 @@ export const ListCustomersWithSubscriptionsParams: core.serialization.ObjectSche export declare namespace ListCustomersWithSubscriptionsParams { export interface Raw { company_ids?: string[] | null; - failed_to_import?: boolean | null; limit?: number | null; name?: string | null; offset?: number | null; diff --git a/src/serialization/resources/credits/client/requests/index.ts b/src/serialization/resources/credits/client/requests/index.ts index a5384e0f..cd419958 100644 --- a/src/serialization/resources/credits/client/requests/index.ts +++ b/src/serialization/resources/credits/client/requests/index.ts @@ -1,8 +1,6 @@ export { CreateBillingCreditRequestBody } from "./CreateBillingCreditRequestBody"; -export { CreateBillingPlanCreditGrantRequestBody } from "./CreateBillingPlanCreditGrantRequestBody"; export { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant"; export { CreateCreditBundleRequestBody } from "./CreateCreditBundleRequestBody"; export { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody"; -export { UpdateBillingPlanCreditGrantRequestBody } from "./UpdateBillingPlanCreditGrantRequestBody"; export { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody"; export { ZeroOutGrantRequestBody } from "./ZeroOutGrantRequestBody"; diff --git a/src/serialization/resources/credits/types/CountCompanyGrantsParams.ts b/src/serialization/resources/credits/types/CountCompanyGrantsParams.ts new file mode 100644 index 00000000..af0940c5 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCompanyGrantsParams.ts @@ -0,0 +1,28 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CreditGrantSortOrder } from "../../../types/CreditGrantSortOrder"; +import { SortDirection } from "../../../types/SortDirection"; + +export const CountCompanyGrantsParams: core.serialization.ObjectSchema< + serializers.CountCompanyGrantsParams.Raw, + Schematic.CountCompanyGrantsParams +> = core.serialization.object({ + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + dir: SortDirection.optional(), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + order: CreditGrantSortOrder.optional(), +}); + +export declare namespace CountCompanyGrantsParams { + export interface Raw { + company_id?: string | null; + dir?: SortDirection.Raw | null; + limit?: number | null; + offset?: number | null; + order?: CreditGrantSortOrder.Raw | null; + } +} diff --git a/src/serialization/resources/credits/types/CountCompanyGrantsResponse.ts b/src/serialization/resources/credits/types/CountCompanyGrantsResponse.ts new file mode 100644 index 00000000..91c4a292 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCompanyGrantsResponse.ts @@ -0,0 +1,22 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { CountResponse } from "../../../types/CountResponse"; +import { CountCompanyGrantsParams } from "./CountCompanyGrantsParams"; + +export const CountCompanyGrantsResponse: core.serialization.ObjectSchema< + serializers.CountCompanyGrantsResponse.Raw, + Schematic.CountCompanyGrantsResponse +> = core.serialization.object({ + data: CountResponse, + params: CountCompanyGrantsParams, +}); + +export declare namespace CountCompanyGrantsResponse { + export interface Raw { + data: CountResponse.Raw; + params: CountCompanyGrantsParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/index.ts b/src/serialization/resources/credits/types/index.ts index 20c740d9..96af477d 100644 --- a/src/serialization/resources/credits/types/index.ts +++ b/src/serialization/resources/credits/types/index.ts @@ -4,6 +4,8 @@ export * from "./CountBillingCreditsParams"; export * from "./CountBillingCreditsResponse"; export * from "./CountBillingPlanCreditGrantsParams"; export * from "./CountBillingPlanCreditGrantsResponse"; +export * from "./CountCompanyGrantsParams"; +export * from "./CountCompanyGrantsResponse"; export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; export * from "./CountCreditLedgerParams"; diff --git a/src/serialization/resources/index.ts b/src/serialization/resources/index.ts index b5c38649..5564974c 100644 --- a/src/serialization/resources/index.ts +++ b/src/serialization/resources/index.ts @@ -31,6 +31,9 @@ export * from "./events/types"; export * as features from "./features"; export * from "./features/client/requests"; export * from "./features/types"; +export * as planbundle from "./planbundle"; +export * from "./planbundle/client/requests"; +export * from "./planbundle/types"; export * as plangroups from "./plangroups"; export * from "./plangroups/client/requests"; export * from "./plangroups/types"; diff --git a/src/serialization/resources/planbundle/client/index.ts b/src/serialization/resources/planbundle/client/index.ts new file mode 100644 index 00000000..415726b7 --- /dev/null +++ b/src/serialization/resources/planbundle/client/index.ts @@ -0,0 +1 @@ +export * from "./requests"; diff --git a/src/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts b/src/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts new file mode 100644 index 00000000..02d2bfdf --- /dev/null +++ b/src/serialization/resources/planbundle/client/requests/CreatePlanBundleRequestBody.ts @@ -0,0 +1,34 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; +import { CreatePlanRequestBody } from "../../../../types/CreatePlanRequestBody"; +import { PlanBundleCreditGrantRequestBody } from "../../../../types/PlanBundleCreditGrantRequestBody"; +import { PlanBundleEntitlementRequestBody } from "../../../../types/PlanBundleEntitlementRequestBody"; +import { UpdatePlanTraitTraitRequestBody } from "../../../../types/UpdatePlanTraitTraitRequestBody"; +import { UpsertBillingProductRequestBody } from "../../../../types/UpsertBillingProductRequestBody"; + +export const CreatePlanBundleRequestBody: core.serialization.Schema< + serializers.CreatePlanBundleRequestBody.Raw, + Schematic.CreatePlanBundleRequestBody +> = core.serialization.object({ + billingProduct: core.serialization.property("billing_product", UpsertBillingProductRequestBody.optional()), + creditGrants: core.serialization.property( + "credit_grants", + core.serialization.list(PlanBundleCreditGrantRequestBody).optional(), + ), + entitlements: core.serialization.list(PlanBundleEntitlementRequestBody), + plan: CreatePlanRequestBody.optional(), + traits: core.serialization.list(UpdatePlanTraitTraitRequestBody).optional(), +}); + +export declare namespace CreatePlanBundleRequestBody { + export interface Raw { + billing_product?: UpsertBillingProductRequestBody.Raw | null; + credit_grants?: PlanBundleCreditGrantRequestBody.Raw[] | null; + entitlements: PlanBundleEntitlementRequestBody.Raw[]; + plan?: CreatePlanRequestBody.Raw | null; + traits?: UpdatePlanTraitTraitRequestBody.Raw[] | null; + } +} diff --git a/src/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts b/src/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts new file mode 100644 index 00000000..5cf4c312 --- /dev/null +++ b/src/serialization/resources/planbundle/client/requests/UpdatePlanBundleRequestBody.ts @@ -0,0 +1,34 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../../api/index"; +import * as core from "../../../../../core"; +import type * as serializers from "../../../../index"; +import { PlanBundleCreditGrantRequestBody } from "../../../../types/PlanBundleCreditGrantRequestBody"; +import { PlanBundleEntitlementRequestBody } from "../../../../types/PlanBundleEntitlementRequestBody"; +import { UpdatePlanRequestBody } from "../../../../types/UpdatePlanRequestBody"; +import { UpdatePlanTraitTraitRequestBody } from "../../../../types/UpdatePlanTraitTraitRequestBody"; +import { UpsertBillingProductRequestBody } from "../../../../types/UpsertBillingProductRequestBody"; + +export const UpdatePlanBundleRequestBody: core.serialization.Schema< + serializers.UpdatePlanBundleRequestBody.Raw, + Schematic.UpdatePlanBundleRequestBody +> = core.serialization.object({ + billingProduct: core.serialization.property("billing_product", UpsertBillingProductRequestBody.optional()), + creditGrants: core.serialization.property( + "credit_grants", + core.serialization.list(PlanBundleCreditGrantRequestBody).optional(), + ), + entitlements: core.serialization.list(PlanBundleEntitlementRequestBody), + plan: UpdatePlanRequestBody.optional(), + traits: core.serialization.list(UpdatePlanTraitTraitRequestBody).optional(), +}); + +export declare namespace UpdatePlanBundleRequestBody { + export interface Raw { + billing_product?: UpsertBillingProductRequestBody.Raw | null; + credit_grants?: PlanBundleCreditGrantRequestBody.Raw[] | null; + entitlements: PlanBundleEntitlementRequestBody.Raw[]; + plan?: UpdatePlanRequestBody.Raw | null; + traits?: UpdatePlanTraitTraitRequestBody.Raw[] | null; + } +} diff --git a/src/serialization/resources/planbundle/client/requests/index.ts b/src/serialization/resources/planbundle/client/requests/index.ts new file mode 100644 index 00000000..1782bd02 --- /dev/null +++ b/src/serialization/resources/planbundle/client/requests/index.ts @@ -0,0 +1,2 @@ +export { CreatePlanBundleRequestBody } from "./CreatePlanBundleRequestBody"; +export { UpdatePlanBundleRequestBody } from "./UpdatePlanBundleRequestBody"; diff --git a/src/serialization/resources/planbundle/index.ts b/src/serialization/resources/planbundle/index.ts new file mode 100644 index 00000000..d2ec2302 --- /dev/null +++ b/src/serialization/resources/planbundle/index.ts @@ -0,0 +1,2 @@ +export * from "./client"; +export * from "./types"; diff --git a/src/serialization/resources/planbundle/types/CreatePlanBundleResponse.ts b/src/serialization/resources/planbundle/types/CreatePlanBundleResponse.ts new file mode 100644 index 00000000..1199cac1 --- /dev/null +++ b/src/serialization/resources/planbundle/types/CreatePlanBundleResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { PlanBundleResponseData } from "../../../types/PlanBundleResponseData"; + +export const CreatePlanBundleResponse: core.serialization.ObjectSchema< + serializers.CreatePlanBundleResponse.Raw, + Schematic.CreatePlanBundleResponse +> = core.serialization.object({ + data: PlanBundleResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace CreatePlanBundleResponse { + export interface Raw { + data: PlanBundleResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/planbundle/types/UpdatePlanBundleResponse.ts b/src/serialization/resources/planbundle/types/UpdatePlanBundleResponse.ts new file mode 100644 index 00000000..8ccec772 --- /dev/null +++ b/src/serialization/resources/planbundle/types/UpdatePlanBundleResponse.ts @@ -0,0 +1,21 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../api/index"; +import * as core from "../../../../core"; +import type * as serializers from "../../../index"; +import { PlanBundleResponseData } from "../../../types/PlanBundleResponseData"; + +export const UpdatePlanBundleResponse: core.serialization.ObjectSchema< + serializers.UpdatePlanBundleResponse.Raw, + Schematic.UpdatePlanBundleResponse +> = core.serialization.object({ + data: PlanBundleResponseData, + params: core.serialization.record(core.serialization.string(), core.serialization.unknown()), +}); + +export declare namespace UpdatePlanBundleResponse { + export interface Raw { + data: PlanBundleResponseData.Raw; + params: Record; + } +} diff --git a/src/serialization/resources/planbundle/types/index.ts b/src/serialization/resources/planbundle/types/index.ts new file mode 100644 index 00000000..d7effde9 --- /dev/null +++ b/src/serialization/resources/planbundle/types/index.ts @@ -0,0 +1,2 @@ +export * from "./CreatePlanBundleResponse"; +export * from "./UpdatePlanBundleResponse"; diff --git a/src/serialization/resources/plans/client/requests/index.ts b/src/serialization/resources/plans/client/requests/index.ts index fd8198c8..18a85614 100644 --- a/src/serialization/resources/plans/client/requests/index.ts +++ b/src/serialization/resources/plans/client/requests/index.ts @@ -1,4 +1 @@ -export { CreatePlanRequestBody } from "./CreatePlanRequestBody"; export { UpdateCompanyPlansRequestBody } from "./UpdateCompanyPlansRequestBody"; -export { UpdatePlanRequestBody } from "./UpdatePlanRequestBody"; -export { UpsertBillingProductRequestBody } from "./UpsertBillingProductRequestBody"; diff --git a/src/serialization/types/BillingCreditGrantResponseData.ts b/src/serialization/types/BillingCreditGrantResponseData.ts index 5ec3de4a..116b6b5d 100644 --- a/src/serialization/types/BillingCreditGrantResponseData.ts +++ b/src/serialization/types/BillingCreditGrantResponseData.ts @@ -5,6 +5,7 @@ import * as core from "../../core"; import type * as serializers from "../index"; import { BillingCreditGrantReason } from "./BillingCreditGrantReason"; import { BillingCreditGrantZeroedOutReason } from "./BillingCreditGrantZeroedOutReason"; +import { BillingPlanCreditGrantResetCadence } from "./BillingPlanCreditGrantResetCadence"; import { BillingPriceResponseData } from "./BillingPriceResponseData"; import { CreditTransferResponseData } from "./CreditTransferResponseData"; @@ -27,6 +28,8 @@ export const BillingCreditGrantResponseData: core.serialization.ObjectSchema< quantity: core.serialization.number(), quantityRemaining: core.serialization.property("quantity_remaining", core.serialization.number()), quantityUsed: core.serialization.property("quantity_used", core.serialization.number()), + renewalEnabled: core.serialization.property("renewal_enabled", core.serialization.boolean()), + renewalPeriod: core.serialization.property("renewal_period", BillingPlanCreditGrantResetCadence.optional()), sourceLabel: core.serialization.property("source_label", core.serialization.string()), transfers: core.serialization.list(CreditTransferResponseData).optional(), updatedAt: core.serialization.property("updated_at", core.serialization.date()), @@ -52,6 +55,8 @@ export declare namespace BillingCreditGrantResponseData { quantity: number; quantity_remaining: number; quantity_used: number; + renewal_enabled: boolean; + renewal_period?: BillingPlanCreditGrantResetCadence.Raw | null; source_label: string; transfers?: CreditTransferResponseData.Raw[] | null; updated_at: string; diff --git a/src/serialization/types/BillingCustomerResponseData.ts b/src/serialization/types/BillingCustomerResponseData.ts index 3d4a7ef3..21f031a1 100644 --- a/src/serialization/types/BillingCustomerResponseData.ts +++ b/src/serialization/types/BillingCustomerResponseData.ts @@ -13,7 +13,6 @@ export const BillingCustomerResponseData: core.serialization.ObjectSchema< deletedAt: core.serialization.property("deleted_at", core.serialization.date().optional()), email: core.serialization.string(), externalId: core.serialization.property("external_id", core.serialization.string()), - failedToImport: core.serialization.property("failed_to_import", core.serialization.boolean()), id: core.serialization.string(), name: core.serialization.string(), providerType: core.serialization.property("provider_type", BillingProviderType), @@ -26,7 +25,6 @@ export declare namespace BillingCustomerResponseData { deleted_at?: string | null; email: string; external_id: string; - failed_to_import: boolean; id: string; name: string; provider_type: BillingProviderType.Raw; diff --git a/src/serialization/types/BillingCustomerWithSubscriptionsResponseData.ts b/src/serialization/types/BillingCustomerWithSubscriptionsResponseData.ts index 1489540b..c68b2c98 100644 --- a/src/serialization/types/BillingCustomerWithSubscriptionsResponseData.ts +++ b/src/serialization/types/BillingCustomerWithSubscriptionsResponseData.ts @@ -14,7 +14,6 @@ export const BillingCustomerWithSubscriptionsResponseData: core.serialization.Ob deletedAt: core.serialization.property("deleted_at", core.serialization.date().optional()), email: core.serialization.string(), externalId: core.serialization.property("external_id", core.serialization.string()), - failedToImport: core.serialization.property("failed_to_import", core.serialization.boolean()), id: core.serialization.string(), name: core.serialization.string(), providerType: core.serialization.property("provider_type", BillingProviderType), @@ -28,7 +27,6 @@ export declare namespace BillingCustomerWithSubscriptionsResponseData { deleted_at?: string | null; email: string; external_id: string; - failed_to_import: boolean; id: string; name: string; provider_type: BillingProviderType.Raw; diff --git a/src/serialization/types/CompanyPlanDetailResponseData.ts b/src/serialization/types/CompanyPlanDetailResponseData.ts index f4c0cab4..612e5f8a 100644 --- a/src/serialization/types/CompanyPlanDetailResponseData.ts +++ b/src/serialization/types/CompanyPlanDetailResponseData.ts @@ -14,6 +14,7 @@ import { PlanControlledByType } from "./PlanControlledByType"; import { PlanCreditGrantView } from "./PlanCreditGrantView"; import { PlanEntitlementResponseData } from "./PlanEntitlementResponseData"; import { PlanType } from "./PlanType"; +import { PlanVersionResponseData } from "./PlanVersionResponseData"; export const CompanyPlanDetailResponseData: core.serialization.ObjectSchema< serializers.CompanyPlanDetailResponseData.Raw, @@ -55,6 +56,7 @@ export const CompanyPlanDetailResponseData: core.serialization.ObjectSchema< updatedAt: core.serialization.property("updated_at", core.serialization.date()), usageViolations: core.serialization.property("usage_violations", core.serialization.list(FeatureUsageResponseData)), valid: core.serialization.boolean(), + versions: core.serialization.list(PlanVersionResponseData), yearlyPrice: core.serialization.property("yearly_price", BillingPriceResponseData.optional()), }); @@ -90,6 +92,7 @@ export declare namespace CompanyPlanDetailResponseData { updated_at: string; usage_violations: FeatureUsageResponseData.Raw[]; valid: boolean; + versions: PlanVersionResponseData.Raw[]; yearly_price?: BillingPriceResponseData.Raw | null; } } diff --git a/src/serialization/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts b/src/serialization/types/CreateBillingPlanCreditGrantRequestBody.ts similarity index 80% rename from src/serialization/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts rename to src/serialization/types/CreateBillingPlanCreditGrantRequestBody.ts index bbb172c9..d9816c3d 100644 --- a/src/serialization/resources/credits/client/requests/CreateBillingPlanCreditGrantRequestBody.ts +++ b/src/serialization/types/CreateBillingPlanCreditGrantRequestBody.ts @@ -1,16 +1,16 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../../api/index"; -import * as core from "../../../../../core"; -import type * as serializers from "../../../../index"; -import { BillingCreditExpiryType } from "../../../../types/BillingCreditExpiryType"; -import { BillingCreditExpiryUnit } from "../../../../types/BillingCreditExpiryUnit"; -import { BillingPlanCreditGrantResetCadence } from "../../../../types/BillingPlanCreditGrantResetCadence"; -import { BillingPlanCreditGrantResetStart } from "../../../../types/BillingPlanCreditGrantResetStart"; -import { BillingPlanCreditGrantResetType } from "../../../../types/BillingPlanCreditGrantResetType"; -import { CreditAutoTopupAmountType } from "../../../../types/CreditAutoTopupAmountType"; +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { BillingCreditExpiryType } from "./BillingCreditExpiryType"; +import { BillingCreditExpiryUnit } from "./BillingCreditExpiryUnit"; +import { BillingPlanCreditGrantResetCadence } from "./BillingPlanCreditGrantResetCadence"; +import { BillingPlanCreditGrantResetStart } from "./BillingPlanCreditGrantResetStart"; +import { BillingPlanCreditGrantResetType } from "./BillingPlanCreditGrantResetType"; +import { CreditAutoTopupAmountType } from "./CreditAutoTopupAmountType"; -export const CreateBillingPlanCreditGrantRequestBody: core.serialization.Schema< +export const CreateBillingPlanCreditGrantRequestBody: core.serialization.ObjectSchema< serializers.CreateBillingPlanCreditGrantRequestBody.Raw, Schematic.CreateBillingPlanCreditGrantRequestBody > = core.serialization.object({ diff --git a/src/serialization/types/CreateEntitlementInBundleRequestBody.ts b/src/serialization/types/CreateEntitlementInBundleRequestBody.ts new file mode 100644 index 00000000..2579faf3 --- /dev/null +++ b/src/serialization/types/CreateEntitlementInBundleRequestBody.ts @@ -0,0 +1,105 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { BillingTiersMode } from "./BillingTiersMode"; +import { CreateEntitlementInBundleRequestBodyMetricPeriod } from "./CreateEntitlementInBundleRequestBodyMetricPeriod"; +import { CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset } from "./CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset"; +import { CreatePriceTierRequestBody } from "./CreatePriceTierRequestBody"; +import { EntitlementPriceBehavior } from "./EntitlementPriceBehavior"; +import { EntitlementValueType } from "./EntitlementValueType"; + +export const CreateEntitlementInBundleRequestBody: core.serialization.ObjectSchema< + serializers.CreateEntitlementInBundleRequestBody.Raw, + Schematic.CreateEntitlementInBundleRequestBody +> = core.serialization.object({ + billingProductId: core.serialization.property("billing_product_id", core.serialization.string().optional()), + billingThreshold: core.serialization.property("billing_threshold", core.serialization.number().optional()), + creditConsumptionRate: core.serialization.property( + "credit_consumption_rate", + core.serialization.number().optional(), + ), + currency: core.serialization.string().optional(), + featureId: core.serialization.property("feature_id", core.serialization.string()), + metricPeriod: core.serialization.property( + "metric_period", + CreateEntitlementInBundleRequestBodyMetricPeriod.optional(), + ), + metricPeriodMonthReset: core.serialization.property( + "metric_period_month_reset", + CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.optional(), + ), + monthlyMeteredPriceId: core.serialization.property( + "monthly_metered_price_id", + core.serialization.string().optional(), + ), + monthlyPriceTiers: core.serialization.property( + "monthly_price_tiers", + core.serialization.list(CreatePriceTierRequestBody).optional(), + ), + monthlyUnitPrice: core.serialization.property("monthly_unit_price", core.serialization.number().optional()), + monthlyUnitPriceDecimal: core.serialization.property( + "monthly_unit_price_decimal", + core.serialization.string().optional(), + ), + overageBillingProductId: core.serialization.property( + "overage_billing_product_id", + core.serialization.string().optional(), + ), + priceBehavior: core.serialization.property("price_behavior", EntitlementPriceBehavior.optional()), + priceTiers: core.serialization.property( + "price_tiers", + core.serialization.list(CreatePriceTierRequestBody).optional(), + ), + softLimit: core.serialization.property("soft_limit", core.serialization.number().optional()), + tierMode: core.serialization.property("tier_mode", BillingTiersMode.optional()), + valueBool: core.serialization.property("value_bool", core.serialization.boolean().optional()), + valueCreditId: core.serialization.property("value_credit_id", core.serialization.string().optional()), + valueNumeric: core.serialization.property("value_numeric", core.serialization.number().optional()), + valueTraitId: core.serialization.property("value_trait_id", core.serialization.string().optional()), + valueType: core.serialization.property("value_type", EntitlementValueType), + yearlyMeteredPriceId: core.serialization.property( + "yearly_metered_price_id", + core.serialization.string().optional(), + ), + yearlyPriceTiers: core.serialization.property( + "yearly_price_tiers", + core.serialization.list(CreatePriceTierRequestBody).optional(), + ), + yearlyUnitPrice: core.serialization.property("yearly_unit_price", core.serialization.number().optional()), + yearlyUnitPriceDecimal: core.serialization.property( + "yearly_unit_price_decimal", + core.serialization.string().optional(), + ), +}); + +export declare namespace CreateEntitlementInBundleRequestBody { + export interface Raw { + billing_product_id?: string | null; + billing_threshold?: number | null; + credit_consumption_rate?: number | null; + currency?: string | null; + feature_id: string; + metric_period?: CreateEntitlementInBundleRequestBodyMetricPeriod.Raw | null; + metric_period_month_reset?: CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.Raw | null; + monthly_metered_price_id?: string | null; + monthly_price_tiers?: CreatePriceTierRequestBody.Raw[] | null; + monthly_unit_price?: number | null; + monthly_unit_price_decimal?: string | null; + overage_billing_product_id?: string | null; + price_behavior?: EntitlementPriceBehavior.Raw | null; + price_tiers?: CreatePriceTierRequestBody.Raw[] | null; + soft_limit?: number | null; + tier_mode?: BillingTiersMode.Raw | null; + value_bool?: boolean | null; + value_credit_id?: string | null; + value_numeric?: number | null; + value_trait_id?: string | null; + value_type: EntitlementValueType.Raw; + yearly_metered_price_id?: string | null; + yearly_price_tiers?: CreatePriceTierRequestBody.Raw[] | null; + yearly_unit_price?: number | null; + yearly_unit_price_decimal?: string | null; + } +} diff --git a/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts b/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts new file mode 100644 index 00000000..4744a74b --- /dev/null +++ b/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriod.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const CreateEntitlementInBundleRequestBodyMetricPeriod: core.serialization.Schema< + serializers.CreateEntitlementInBundleRequestBodyMetricPeriod.Raw, + Schematic.CreateEntitlementInBundleRequestBodyMetricPeriod +> = core.serialization.enum_(["all_time", "current_month", "current_week", "current_day"]); + +export declare namespace CreateEntitlementInBundleRequestBodyMetricPeriod { + export type Raw = "all_time" | "current_month" | "current_week" | "current_day"; +} diff --git a/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts b/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts new file mode 100644 index 00000000..09370f14 --- /dev/null +++ b/src/serialization/types/CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset: core.serialization.Schema< + serializers.CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset.Raw, + Schematic.CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset +> = core.serialization.enum_(["first_of_month", "billing_cycle"]); + +export declare namespace CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset { + export type Raw = "first_of_month" | "billing_cycle"; +} diff --git a/src/serialization/resources/plans/client/requests/CreatePlanRequestBody.ts b/src/serialization/types/CreatePlanRequestBody.ts similarity index 67% rename from src/serialization/resources/plans/client/requests/CreatePlanRequestBody.ts rename to src/serialization/types/CreatePlanRequestBody.ts index b5cf86d4..3cdddf30 100644 --- a/src/serialization/resources/plans/client/requests/CreatePlanRequestBody.ts +++ b/src/serialization/types/CreatePlanRequestBody.ts @@ -1,11 +1,11 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../../api/index"; -import * as core from "../../../../../core"; -import type * as serializers from "../../../../index"; -import { PlanType } from "../../../../types/PlanType"; +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { PlanType } from "./PlanType"; -export const CreatePlanRequestBody: core.serialization.Schema< +export const CreatePlanRequestBody: core.serialization.ObjectSchema< serializers.CreatePlanRequestBody.Raw, Schematic.CreatePlanRequestBody > = core.serialization.object({ diff --git a/src/serialization/types/CreditCompanyGrantView.ts b/src/serialization/types/CreditCompanyGrantView.ts index 8e0eaaa1..0daf22e2 100644 --- a/src/serialization/types/CreditCompanyGrantView.ts +++ b/src/serialization/types/CreditCompanyGrantView.ts @@ -7,6 +7,7 @@ import { BillingCreditExpiryType } from "./BillingCreditExpiryType"; import { BillingCreditExpiryUnit } from "./BillingCreditExpiryUnit"; import { BillingCreditGrantReason } from "./BillingCreditGrantReason"; import { BillingCreditGrantZeroedOutReason } from "./BillingCreditGrantZeroedOutReason"; +import { BillingPlanCreditGrantResetCadence } from "./BillingPlanCreditGrantResetCadence"; import { BillingProductPriceResponseData } from "./BillingProductPriceResponseData"; import { CreditTransferView } from "./CreditTransferView"; @@ -39,6 +40,8 @@ export const CreditCompanyGrantView: core.serialization.ObjectSchema< quantity: core.serialization.number(), quantityRemaining: core.serialization.property("quantity_remaining", core.serialization.number()), quantityUsed: core.serialization.property("quantity_used", core.serialization.number()), + renewalEnabled: core.serialization.property("renewal_enabled", core.serialization.boolean()), + renewalPeriod: core.serialization.property("renewal_period", BillingPlanCreditGrantResetCadence.optional()), singularName: core.serialization.property("singular_name", core.serialization.string().optional()), sourceLabel: core.serialization.property("source_label", core.serialization.string()), transfers: core.serialization.list(CreditTransferView).optional(), @@ -72,6 +75,8 @@ export declare namespace CreditCompanyGrantView { quantity: number; quantity_remaining: number; quantity_used: number; + renewal_enabled: boolean; + renewal_period?: BillingPlanCreditGrantResetCadence.Raw | null; singular_name?: string | null; source_label: string; transfers?: CreditTransferView.Raw[] | null; diff --git a/src/serialization/types/DeleteBillingPlanCreditGrantRequestBody.ts b/src/serialization/types/DeleteBillingPlanCreditGrantRequestBody.ts new file mode 100644 index 00000000..3c3e34c7 --- /dev/null +++ b/src/serialization/types/DeleteBillingPlanCreditGrantRequestBody.ts @@ -0,0 +1,18 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const DeleteBillingPlanCreditGrantRequestBody: core.serialization.ObjectSchema< + serializers.DeleteBillingPlanCreditGrantRequestBody.Raw, + Schematic.DeleteBillingPlanCreditGrantRequestBody +> = core.serialization.object({ + applyToExisting: core.serialization.property("apply_to_existing", core.serialization.boolean().optional()), +}); + +export declare namespace DeleteBillingPlanCreditGrantRequestBody { + export interface Raw { + apply_to_existing?: boolean | null; + } +} diff --git a/src/serialization/types/EventDetailResponseData.ts b/src/serialization/types/EventDetailResponseData.ts index 6f994425..af8ae92a 100644 --- a/src/serialization/types/EventDetailResponseData.ts +++ b/src/serialization/types/EventDetailResponseData.ts @@ -30,7 +30,7 @@ export const EventDetailResponseData: core.serialization.ObjectSchema< status: EventStatus, subtype: core.serialization.string().optional(), type: EventType, - updatedAt: core.serialization.property("updated_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date().optional()), user: PreviewObject.optional(), userId: core.serialization.property("user_id", core.serialization.string().optional()), }); @@ -56,7 +56,7 @@ export declare namespace EventDetailResponseData { status: EventStatus.Raw; subtype?: string | null; type: EventType.Raw; - updated_at: string; + updated_at?: string | null; user?: PreviewObject.Raw | null; user_id?: string | null; } diff --git a/src/serialization/types/EventResponseData.ts b/src/serialization/types/EventResponseData.ts index bd96587b..b6caa6a6 100644 --- a/src/serialization/types/EventResponseData.ts +++ b/src/serialization/types/EventResponseData.ts @@ -27,7 +27,7 @@ export const EventResponseData: core.serialization.ObjectSchema< status: EventStatus, subtype: core.serialization.string().optional(), type: EventType, - updatedAt: core.serialization.property("updated_at", core.serialization.date()), + updatedAt: core.serialization.property("updated_at", core.serialization.date().optional()), userId: core.serialization.property("user_id", core.serialization.string().optional()), }); @@ -50,7 +50,7 @@ export declare namespace EventResponseData { status: EventStatus.Raw; subtype?: string | null; type: EventType.Raw; - updated_at: string; + updated_at?: string | null; user_id?: string | null; } } diff --git a/src/serialization/types/PlanBundleAction.ts b/src/serialization/types/PlanBundleAction.ts new file mode 100644 index 00000000..e6a70985 --- /dev/null +++ b/src/serialization/types/PlanBundleAction.ts @@ -0,0 +1,12 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const PlanBundleAction: core.serialization.Schema = + core.serialization.enum_(["create", "update", "delete"]); + +export declare namespace PlanBundleAction { + export type Raw = "create" | "update" | "delete"; +} diff --git a/src/serialization/types/PlanBundleCreditGrantRequestBody.ts b/src/serialization/types/PlanBundleCreditGrantRequestBody.ts new file mode 100644 index 00000000..e02eb60c --- /dev/null +++ b/src/serialization/types/PlanBundleCreditGrantRequestBody.ts @@ -0,0 +1,30 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { CreateBillingPlanCreditGrantRequestBody } from "./CreateBillingPlanCreditGrantRequestBody"; +import { DeleteBillingPlanCreditGrantRequestBody } from "./DeleteBillingPlanCreditGrantRequestBody"; +import { PlanBundleAction } from "./PlanBundleAction"; +import { UpdateBillingPlanCreditGrantRequestBody } from "./UpdateBillingPlanCreditGrantRequestBody"; + +export const PlanBundleCreditGrantRequestBody: core.serialization.ObjectSchema< + serializers.PlanBundleCreditGrantRequestBody.Raw, + Schematic.PlanBundleCreditGrantRequestBody +> = core.serialization.object({ + action: PlanBundleAction, + createReq: core.serialization.property("create_req", CreateBillingPlanCreditGrantRequestBody.optional()), + creditGrantId: core.serialization.property("credit_grant_id", core.serialization.string().optional()), + deleteReq: core.serialization.property("delete_req", DeleteBillingPlanCreditGrantRequestBody.optional()), + updateReq: core.serialization.property("update_req", UpdateBillingPlanCreditGrantRequestBody.optional()), +}); + +export declare namespace PlanBundleCreditGrantRequestBody { + export interface Raw { + action: PlanBundleAction.Raw; + create_req?: CreateBillingPlanCreditGrantRequestBody.Raw | null; + credit_grant_id?: string | null; + delete_req?: DeleteBillingPlanCreditGrantRequestBody.Raw | null; + update_req?: UpdateBillingPlanCreditGrantRequestBody.Raw | null; + } +} diff --git a/src/serialization/types/PlanBundleEntitlementRequestBody.ts b/src/serialization/types/PlanBundleEntitlementRequestBody.ts new file mode 100644 index 00000000..c746f178 --- /dev/null +++ b/src/serialization/types/PlanBundleEntitlementRequestBody.ts @@ -0,0 +1,24 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { CreateEntitlementInBundleRequestBody } from "./CreateEntitlementInBundleRequestBody"; +import { PlanBundleAction } from "./PlanBundleAction"; + +export const PlanBundleEntitlementRequestBody: core.serialization.ObjectSchema< + serializers.PlanBundleEntitlementRequestBody.Raw, + Schematic.PlanBundleEntitlementRequestBody +> = core.serialization.object({ + action: PlanBundleAction, + entitlementId: core.serialization.property("entitlement_id", core.serialization.string().optional()), + req: CreateEntitlementInBundleRequestBody.optional(), +}); + +export declare namespace PlanBundleEntitlementRequestBody { + export interface Raw { + action: PlanBundleAction.Raw; + entitlement_id?: string | null; + req?: CreateEntitlementInBundleRequestBody.Raw | null; + } +} diff --git a/src/serialization/types/PlanBundleResponseData.ts b/src/serialization/types/PlanBundleResponseData.ts new file mode 100644 index 00000000..8c404b10 --- /dev/null +++ b/src/serialization/types/PlanBundleResponseData.ts @@ -0,0 +1,34 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { BillingPlanCreditGrantResponseData } from "./BillingPlanCreditGrantResponseData"; +import { BillingProductPlanResponseData } from "./BillingProductPlanResponseData"; +import { PlanEntitlementResponseData } from "./PlanEntitlementResponseData"; +import { PlanResponseData } from "./PlanResponseData"; +import { PlanTraitResponseData } from "./PlanTraitResponseData"; + +export const PlanBundleResponseData: core.serialization.ObjectSchema< + serializers.PlanBundleResponseData.Raw, + Schematic.PlanBundleResponseData +> = core.serialization.object({ + billingProduct: core.serialization.property("billing_product", BillingProductPlanResponseData.optional()), + creditGrants: core.serialization.property( + "credit_grants", + core.serialization.list(BillingPlanCreditGrantResponseData).optional(), + ), + entitlements: core.serialization.list(PlanEntitlementResponseData).optional(), + plan: PlanResponseData.optional(), + traits: core.serialization.list(PlanTraitResponseData).optional(), +}); + +export declare namespace PlanBundleResponseData { + export interface Raw { + billing_product?: BillingProductPlanResponseData.Raw | null; + credit_grants?: BillingPlanCreditGrantResponseData.Raw[] | null; + entitlements?: PlanEntitlementResponseData.Raw[] | null; + plan?: PlanResponseData.Raw | null; + traits?: PlanTraitResponseData.Raw[] | null; + } +} diff --git a/src/serialization/types/PlanChangeSubscriptionAction.ts b/src/serialization/types/PlanChangeSubscriptionAction.ts index f095a491..09c6f3f4 100644 --- a/src/serialization/types/PlanChangeSubscriptionAction.ts +++ b/src/serialization/types/PlanChangeSubscriptionAction.ts @@ -7,8 +7,23 @@ import type * as serializers from "../index"; export const PlanChangeSubscriptionAction: core.serialization.Schema< serializers.PlanChangeSubscriptionAction.Raw, Schematic.PlanChangeSubscriptionAction -> = core.serialization.enum_(["downgrade", "invalid", "subscribe", "unsubscribe", "upgrade", "upgrade_trial"]); +> = core.serialization.enum_([ + "adjustment", + "downgrade", + "invalid", + "subscribe", + "unsubscribe", + "upgrade", + "upgrade_trial", +]); export declare namespace PlanChangeSubscriptionAction { - export type Raw = "downgrade" | "invalid" | "subscribe" | "unsubscribe" | "upgrade" | "upgrade_trial"; + export type Raw = + | "adjustment" + | "downgrade" + | "invalid" + | "subscribe" + | "unsubscribe" + | "upgrade" + | "upgrade_trial"; } diff --git a/src/serialization/types/PlanDetailResponseData.ts b/src/serialization/types/PlanDetailResponseData.ts index 6f0bc6fd..18c79219 100644 --- a/src/serialization/types/PlanDetailResponseData.ts +++ b/src/serialization/types/PlanDetailResponseData.ts @@ -10,6 +10,7 @@ import { ChargeType } from "./ChargeType"; import { FeatureDetailResponseData } from "./FeatureDetailResponseData"; import { PlanControlledByType } from "./PlanControlledByType"; import { PlanType } from "./PlanType"; +import { PlanVersionResponseData } from "./PlanVersionResponseData"; export const PlanDetailResponseData: core.serialization.ObjectSchema< serializers.PlanDetailResponseData.Raw, @@ -38,6 +39,7 @@ export const PlanDetailResponseData: core.serialization.ObjectSchema< planType: core.serialization.property("plan_type", PlanType), trialDays: core.serialization.property("trial_days", core.serialization.number().optional()), updatedAt: core.serialization.property("updated_at", core.serialization.date()), + versions: core.serialization.list(PlanVersionResponseData), yearlyPrice: core.serialization.property("yearly_price", BillingPriceResponseData.optional()), }); @@ -63,6 +65,7 @@ export declare namespace PlanDetailResponseData { plan_type: PlanType.Raw; trial_days?: number | null; updated_at: string; + versions: PlanVersionResponseData.Raw[]; yearly_price?: BillingPriceResponseData.Raw | null; } } diff --git a/src/serialization/types/PlanGroupPlanDetailResponseData.ts b/src/serialization/types/PlanGroupPlanDetailResponseData.ts index 62a849be..f7625ea5 100644 --- a/src/serialization/types/PlanGroupPlanDetailResponseData.ts +++ b/src/serialization/types/PlanGroupPlanDetailResponseData.ts @@ -12,6 +12,7 @@ import { FeatureDetailResponseData } from "./FeatureDetailResponseData"; import { PlanControlledByType } from "./PlanControlledByType"; import { PlanEntitlementResponseData } from "./PlanEntitlementResponseData"; import { PlanType } from "./PlanType"; +import { PlanVersionResponseData } from "./PlanVersionResponseData"; export const PlanGroupPlanDetailResponseData: core.serialization.ObjectSchema< serializers.PlanGroupPlanDetailResponseData.Raw, @@ -47,6 +48,7 @@ export const PlanGroupPlanDetailResponseData: core.serialization.ObjectSchema< planType: core.serialization.property("plan_type", PlanType), trialDays: core.serialization.property("trial_days", core.serialization.number().optional()), updatedAt: core.serialization.property("updated_at", core.serialization.date()), + versions: core.serialization.list(PlanVersionResponseData), yearlyPrice: core.serialization.property("yearly_price", BillingPriceResponseData.optional()), }); @@ -76,6 +78,7 @@ export declare namespace PlanGroupPlanDetailResponseData { plan_type: PlanType.Raw; trial_days?: number | null; updated_at: string; + versions: PlanVersionResponseData.Raw[]; yearly_price?: BillingPriceResponseData.Raw | null; } } diff --git a/src/serialization/types/PlanVersionResponseData.ts b/src/serialization/types/PlanVersionResponseData.ts new file mode 100644 index 00000000..3ae27dca --- /dev/null +++ b/src/serialization/types/PlanVersionResponseData.ts @@ -0,0 +1,40 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { PlanType } from "./PlanType"; +import { PlanVersionStatus } from "./PlanVersionStatus"; + +export const PlanVersionResponseData: core.serialization.ObjectSchema< + serializers.PlanVersionResponseData.Raw, + Schematic.PlanVersionResponseData +> = core.serialization.object({ + createdAt: core.serialization.property("created_at", core.serialization.date()), + description: core.serialization.string(), + environmentId: core.serialization.property("environment_id", core.serialization.string()), + icon: core.serialization.string(), + id: core.serialization.string(), + name: core.serialization.string(), + originalPlanId: core.serialization.property("original_plan_id", core.serialization.string().optional()), + planType: core.serialization.property("plan_type", PlanType), + status: PlanVersionStatus, + updatedAt: core.serialization.property("updated_at", core.serialization.date()), + version: core.serialization.number(), +}); + +export declare namespace PlanVersionResponseData { + export interface Raw { + created_at: string; + description: string; + environment_id: string; + icon: string; + id: string; + name: string; + original_plan_id?: string | null; + plan_type: PlanType.Raw; + status: PlanVersionStatus.Raw; + updated_at: string; + version: number; + } +} diff --git a/src/serialization/types/PlanVersionStatus.ts b/src/serialization/types/PlanVersionStatus.ts new file mode 100644 index 00000000..fc6695fc --- /dev/null +++ b/src/serialization/types/PlanVersionStatus.ts @@ -0,0 +1,14 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; + +export const PlanVersionStatus: core.serialization.Schema< + serializers.PlanVersionStatus.Raw, + Schematic.PlanVersionStatus +> = core.serialization.enum_(["published", "draft", "archived"]); + +export declare namespace PlanVersionStatus { + export type Raw = "published" | "draft" | "archived"; +} diff --git a/src/serialization/types/RawEventResponseData.ts b/src/serialization/types/RawEventResponseData.ts index 8a1d328c..ae1eaeba 100644 --- a/src/serialization/types/RawEventResponseData.ts +++ b/src/serialization/types/RawEventResponseData.ts @@ -10,7 +10,7 @@ export const RawEventResponseData: core.serialization.ObjectSchema< > = core.serialization.object({ capturedAt: core.serialization.property("captured_at", core.serialization.date()), eventId: core.serialization.property("event_id", core.serialization.string().optional()), - remoteAddr: core.serialization.property("remote_addr", core.serialization.string()), + remoteAddr: core.serialization.property("remote_addr", core.serialization.string().optional()), remoteIp: core.serialization.property("remote_ip", core.serialization.string()), userAgent: core.serialization.property("user_agent", core.serialization.string()), }); @@ -19,7 +19,7 @@ export declare namespace RawEventResponseData { export interface Raw { captured_at: string; event_id?: string | null; - remote_addr: string; + remote_addr?: string | null; remote_ip: string; user_agent: string; } diff --git a/src/serialization/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts b/src/serialization/types/UpdateBillingPlanCreditGrantRequestBody.ts similarity index 79% rename from src/serialization/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts rename to src/serialization/types/UpdateBillingPlanCreditGrantRequestBody.ts index 80f2c5a5..c5d1dc12 100644 --- a/src/serialization/resources/credits/client/requests/UpdateBillingPlanCreditGrantRequestBody.ts +++ b/src/serialization/types/UpdateBillingPlanCreditGrantRequestBody.ts @@ -1,16 +1,16 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../../api/index"; -import * as core from "../../../../../core"; -import type * as serializers from "../../../../index"; -import { BillingCreditExpiryType } from "../../../../types/BillingCreditExpiryType"; -import { BillingCreditExpiryUnit } from "../../../../types/BillingCreditExpiryUnit"; -import { BillingPlanCreditGrantResetCadence } from "../../../../types/BillingPlanCreditGrantResetCadence"; -import { BillingPlanCreditGrantResetStart } from "../../../../types/BillingPlanCreditGrantResetStart"; -import { BillingPlanCreditGrantResetType } from "../../../../types/BillingPlanCreditGrantResetType"; -import { CreditAutoTopupAmountType } from "../../../../types/CreditAutoTopupAmountType"; +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { BillingCreditExpiryType } from "./BillingCreditExpiryType"; +import { BillingCreditExpiryUnit } from "./BillingCreditExpiryUnit"; +import { BillingPlanCreditGrantResetCadence } from "./BillingPlanCreditGrantResetCadence"; +import { BillingPlanCreditGrantResetStart } from "./BillingPlanCreditGrantResetStart"; +import { BillingPlanCreditGrantResetType } from "./BillingPlanCreditGrantResetType"; +import { CreditAutoTopupAmountType } from "./CreditAutoTopupAmountType"; -export const UpdateBillingPlanCreditGrantRequestBody: core.serialization.Schema< +export const UpdateBillingPlanCreditGrantRequestBody: core.serialization.ObjectSchema< serializers.UpdateBillingPlanCreditGrantRequestBody.Raw, Schematic.UpdateBillingPlanCreditGrantRequestBody > = core.serialization.object({ diff --git a/src/serialization/resources/plans/client/requests/UpdatePlanRequestBody.ts b/src/serialization/types/UpdatePlanRequestBody.ts similarity index 69% rename from src/serialization/resources/plans/client/requests/UpdatePlanRequestBody.ts rename to src/serialization/types/UpdatePlanRequestBody.ts index 5df46b19..75a84cdb 100644 --- a/src/serialization/resources/plans/client/requests/UpdatePlanRequestBody.ts +++ b/src/serialization/types/UpdatePlanRequestBody.ts @@ -1,10 +1,10 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../../api/index"; -import * as core from "../../../../../core"; -import type * as serializers from "../../../../index"; +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; -export const UpdatePlanRequestBody: core.serialization.Schema< +export const UpdatePlanRequestBody: core.serialization.ObjectSchema< serializers.UpdatePlanRequestBody.Raw, Schematic.UpdatePlanRequestBody > = core.serialization.object({ diff --git a/src/serialization/resources/plans/client/requests/UpsertBillingProductRequestBody.ts b/src/serialization/types/UpsertBillingProductRequestBody.ts similarity index 89% rename from src/serialization/resources/plans/client/requests/UpsertBillingProductRequestBody.ts rename to src/serialization/types/UpsertBillingProductRequestBody.ts index d3ddf5e6..ab2c9a1f 100644 --- a/src/serialization/resources/plans/client/requests/UpsertBillingProductRequestBody.ts +++ b/src/serialization/types/UpsertBillingProductRequestBody.ts @@ -1,11 +1,11 @@ // This file was auto-generated by Fern from our API Definition. -import type * as Schematic from "../../../../../api/index"; -import * as core from "../../../../../core"; -import type * as serializers from "../../../../index"; -import { ChargeType } from "../../../../types/ChargeType"; +import type * as Schematic from "../../api/index"; +import * as core from "../../core"; +import type * as serializers from "../index"; +import { ChargeType } from "./ChargeType"; -export const UpsertBillingProductRequestBody: core.serialization.Schema< +export const UpsertBillingProductRequestBody: core.serialization.ObjectSchema< serializers.UpsertBillingProductRequestBody.Raw, Schematic.UpsertBillingProductRequestBody > = core.serialization.object({ diff --git a/src/serialization/types/WebhookRequestType.ts b/src/serialization/types/WebhookRequestType.ts index 484474aa..e38cce50 100644 --- a/src/serialization/types/WebhookRequestType.ts +++ b/src/serialization/types/WebhookRequestType.ts @@ -43,6 +43,8 @@ export const WebhookRequestType: core.serialization.Schema< "user.created", "user.deleted", "user.updated", + "auto.topup.hard.failure", + "auto.topup.retry.exceeded", ]); export declare namespace WebhookRequestType { @@ -81,5 +83,7 @@ export declare namespace WebhookRequestType { | "test.send" | "user.created" | "user.deleted" - | "user.updated"; + | "user.updated" + | "auto.topup.hard.failure" + | "auto.topup.retry.exceeded"; } diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 784ea32a..08e8d434 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -87,7 +87,11 @@ export * from "./ConditionMetricPeriodMonthReset"; export * from "./ConditionOperator"; export * from "./CountResponse"; export * from "./CouponRequestBody"; +export * from "./CreateBillingPlanCreditGrantRequestBody"; export * from "./CreateBillingPriceTierRequestBody"; +export * from "./CreateEntitlementInBundleRequestBody"; +export * from "./CreateEntitlementInBundleRequestBodyMetricPeriod"; +export * from "./CreateEntitlementInBundleRequestBodyMetricPeriodMonthReset"; export * from "./CreateEntitlementReqCommon"; export * from "./CreateEntitlementReqCommonMetricPeriod"; export * from "./CreateEntitlementReqCommonMetricPeriodMonthReset"; @@ -102,6 +106,7 @@ export * from "./CreateOrUpdateConditionRequestBodyOperator"; export * from "./CreateOrUpdateFlagRequestBody"; export * from "./CreateOrUpdateRuleRequestBody"; export * from "./CreateOrUpdateRuleRequestBodyRuleType"; +export * from "./CreatePlanRequestBody"; export * from "./CreatePriceTierRequestBody"; export * from "./CreditAutoTopupAmountType"; export * from "./CreditBundlePurchaseResponseData"; @@ -123,6 +128,7 @@ export * from "./DataExportOutputFileType"; export * from "./DataExportResponseData"; export * from "./DataExportStatus"; export * from "./DataExportType"; +export * from "./DeleteBillingPlanCreditGrantRequestBody"; export * from "./DeleteResponse"; export * from "./DuplicatePlanEntitlementsResponseResponseData"; export * from "./EntitlementPriceBehavior"; @@ -176,6 +182,10 @@ export * from "./MeterRequestBody"; export * from "./OrderedPlansInGroup"; export * from "./PaymentMethodRequestBody"; export * from "./PaymentMethodResponseData"; +export * from "./PlanBundleAction"; +export * from "./PlanBundleCreditGrantRequestBody"; +export * from "./PlanBundleEntitlementRequestBody"; +export * from "./PlanBundleResponseData"; export * from "./PlanChangeAction"; export * from "./PlanChangeActorType"; export * from "./PlanChangeBasePlanAction"; @@ -197,6 +207,8 @@ export * from "./PlanSelection"; export * from "./PlanSnapshotView"; export * from "./PlanTraitResponseData"; export * from "./PlanType"; +export * from "./PlanVersionResponseData"; +export * from "./PlanVersionStatus"; export * from "./PreviewObject"; export * from "./PreviewObjectResponseData"; export * from "./PreviewSubscriptionChangeResponseData"; @@ -252,13 +264,16 @@ export * from "./TraitDefinition"; export * from "./TraitDefinitionComparableType"; export * from "./TraitType"; export * from "./UpdateAddOnRequestBody"; +export * from "./UpdateBillingPlanCreditGrantRequestBody"; export * from "./UpdateCreditBundleRequestBody"; export * from "./UpdateEntitlementReqCommon"; export * from "./UpdateEntitlementReqCommonMetricPeriod"; export * from "./UpdateEntitlementReqCommonMetricPeriodMonthReset"; export * from "./UpdatePayInAdvanceRequestBody"; +export * from "./UpdatePlanRequestBody"; export * from "./UpdatePlanTraitTraitRequestBody"; export * from "./UpdateRuleRequestBody"; +export * from "./UpsertBillingProductRequestBody"; export * from "./UpsertCompanyRequestBody"; export * from "./UpsertTraitRequestBody"; export * from "./UpsertUserRequestBody"; diff --git a/tests/wire/billing.test.ts b/tests/wire/billing.test.ts index c75ab8f8..063457c1 100644 --- a/tests/wire/billing.test.ts +++ b/tests/wire/billing.test.ts @@ -404,20 +404,13 @@ describe("BillingClient", () => { test("upsertBillingCustomer (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { key: "value" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { key: "value" }, name: "name" }; const rawResponseBody = { data: { company_id: "company_id", deleted_at: "2024-01-15T09:30:00Z", email: "email", external_id: "external_id", - failed_to_import: true, id: "id", name: "name", provider_type: "schematic", @@ -437,7 +430,6 @@ describe("BillingClient", () => { const response = await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { key: "value", }, @@ -449,7 +441,6 @@ describe("BillingClient", () => { deletedAt: new Date("2024-01-15T09:30:00.000Z"), email: "email", externalId: "external_id", - failedToImport: true, id: "id", name: "name", providerType: "schematic", @@ -464,13 +455,7 @@ describe("BillingClient", () => { test("upsertBillingCustomer (2)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { meta: "meta" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { meta: "meta" }, name: "name" }; const rawResponseBody = { error: "error" }; server .mockEndpoint() @@ -485,7 +470,6 @@ describe("BillingClient", () => { return await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { meta: "meta", }, @@ -497,13 +481,7 @@ describe("BillingClient", () => { test("upsertBillingCustomer (3)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { meta: "meta" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { meta: "meta" }, name: "name" }; const rawResponseBody = { error: "error" }; server .mockEndpoint() @@ -518,7 +496,6 @@ describe("BillingClient", () => { return await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { meta: "meta", }, @@ -530,13 +507,7 @@ describe("BillingClient", () => { test("upsertBillingCustomer (4)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { meta: "meta" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { meta: "meta" }, name: "name" }; const rawResponseBody = { error: "error" }; server .mockEndpoint() @@ -551,7 +522,6 @@ describe("BillingClient", () => { return await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { meta: "meta", }, @@ -563,13 +533,7 @@ describe("BillingClient", () => { test("upsertBillingCustomer (5)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { meta: "meta" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { meta: "meta" }, name: "name" }; const rawResponseBody = { error: "error" }; server .mockEndpoint() @@ -584,7 +548,6 @@ describe("BillingClient", () => { return await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { meta: "meta", }, @@ -596,13 +559,7 @@ describe("BillingClient", () => { test("upsertBillingCustomer (6)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); - const rawRequestBody = { - email: "email", - external_id: "external_id", - failed_to_import: true, - meta: { meta: "meta" }, - name: "name", - }; + const rawRequestBody = { email: "email", external_id: "external_id", meta: { meta: "meta" }, name: "name" }; const rawResponseBody = { error: "error" }; server .mockEndpoint() @@ -617,7 +574,6 @@ describe("BillingClient", () => { return await client.billing.upsertBillingCustomer({ email: "email", externalId: "external_id", - failedToImport: true, meta: { meta: "meta", }, @@ -637,7 +593,6 @@ describe("BillingClient", () => { deleted_at: "2024-01-15T09:30:00Z", email: "email", external_id: "external_id", - failed_to_import: true, id: "id", name: "name", provider_type: "schematic", @@ -655,7 +610,6 @@ describe("BillingClient", () => { ], params: { company_ids: ["company_ids"], - failed_to_import: true, limit: 1, name: "name", offset: 1, @@ -666,7 +620,6 @@ describe("BillingClient", () => { server.mockEndpoint().get("/billing/customers").respondWith().statusCode(200).jsonBody(rawResponseBody).build(); const response = await client.billing.listCustomersWithSubscriptions({ - failedToImport: true, name: "name", providerType: "schematic", q: "q", @@ -680,7 +633,6 @@ describe("BillingClient", () => { deletedAt: new Date("2024-01-15T09:30:00.000Z"), email: "email", externalId: "external_id", - failedToImport: true, id: "id", name: "name", providerType: "schematic", @@ -698,7 +650,6 @@ describe("BillingClient", () => { ], params: { companyIds: ["company_ids"], - failedToImport: true, limit: 1, name: "name", offset: 1, @@ -776,7 +727,6 @@ describe("BillingClient", () => { data: { count: 1 }, params: { company_ids: ["company_ids"], - failed_to_import: true, limit: 1, name: "name", offset: 1, @@ -793,7 +743,6 @@ describe("BillingClient", () => { .build(); const response = await client.billing.countCustomers({ - failedToImport: true, name: "name", providerType: "schematic", q: "q", @@ -806,7 +755,6 @@ describe("BillingClient", () => { }, params: { companyIds: ["company_ids"], - failedToImport: true, limit: 1, name: "name", offset: 1, diff --git a/tests/wire/checkout.test.ts b/tests/wire/checkout.test.ts index d047e0ff..7a8625f5 100644 --- a/tests/wire/checkout.test.ts +++ b/tests/wire/checkout.test.ts @@ -559,6 +559,20 @@ describe("CheckoutClient", () => { name: "name", plan_type: "plan", updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], }, ], active_plan: { @@ -707,6 +721,20 @@ describe("CheckoutClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1139,6 +1167,20 @@ describe("CheckoutClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1339,6 +1381,20 @@ describe("CheckoutClient", () => { name: "name", planType: "plan", updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], }, ], activePlan: { @@ -1502,6 +1558,20 @@ describe("CheckoutClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1968,6 +2038,20 @@ describe("CheckoutClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", diff --git a/tests/wire/companies.test.ts b/tests/wire/companies.test.ts index ad98b076..bc54121b 100644 --- a/tests/wire/companies.test.ts +++ b/tests/wire/companies.test.ts @@ -9160,7 +9160,7 @@ describe("CompaniesClient", () => { name: "name", }, request_id: "request_id", - subscription_change_action: "downgrade", + subscription_change_action: "adjustment", traits_updated: [ { feature_id: "feature_id", @@ -9260,7 +9260,7 @@ describe("CompaniesClient", () => { name: "name", }, requestId: "request_id", - subscriptionChangeAction: "downgrade", + subscriptionChangeAction: "adjustment", traitsUpdated: [ { featureId: "feature_id", @@ -9404,7 +9404,7 @@ describe("CompaniesClient", () => { id: "id", previous_base_plan: { deleted: true, description: "description", icon: "icon", id: "id", name: "name" }, request_id: "request_id", - subscription_change_action: "downgrade", + subscription_change_action: "adjustment", traits_updated: [ { feature_id: "feature_id", @@ -9510,7 +9510,7 @@ describe("CompaniesClient", () => { name: "name", }, requestId: "request_id", - subscriptionChangeAction: "downgrade", + subscriptionChangeAction: "adjustment", traitsUpdated: [ { featureId: "feature_id", diff --git a/tests/wire/components.test.ts b/tests/wire/components.test.ts index aa380627..0787011f 100644 --- a/tests/wire/components.test.ts +++ b/tests/wire/components.test.ts @@ -858,6 +858,20 @@ describe("ComponentsClient", () => { }, ], valid: true, + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], }, ], active_plans: [ @@ -991,6 +1005,20 @@ describe("ComponentsClient", () => { }, ], valid: true, + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], }, ], active_usage_based_entitlements: [{ feature_id: "feature_id", value_type: "boolean" }], @@ -1290,6 +1318,7 @@ describe("ComponentsClient", () => { quantity: 1, quantity_remaining: 1.1, quantity_used: 1.1, + renewal_enabled: true, source_label: "source_label", updated_at: "2024-01-15T09:30:00Z", }, @@ -1440,6 +1469,20 @@ describe("ComponentsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1628,6 +1671,20 @@ describe("ComponentsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1904,6 +1961,20 @@ describe("ComponentsClient", () => { }, ], valid: true, + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], }, ], activePlans: [ @@ -2052,6 +2123,20 @@ describe("ComponentsClient", () => { }, ], valid: true, + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], }, ], activeUsageBasedEntitlements: [ @@ -2373,6 +2458,7 @@ describe("ComponentsClient", () => { quantity: 1, quantityRemaining: 1.1, quantityUsed: 1.1, + renewalEnabled: true, sourceLabel: "source_label", updatedAt: new Date("2024-01-15T09:30:00.000Z"), }, @@ -2538,6 +2624,20 @@ describe("ComponentsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -2741,6 +2841,20 @@ describe("ComponentsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", diff --git a/tests/wire/credits.test.ts b/tests/wire/credits.test.ts index 96b47cb7..7354a831 100644 --- a/tests/wire/credits.test.ts +++ b/tests/wire/credits.test.ts @@ -2144,6 +2144,8 @@ describe("CreditsClient", () => { quantity: 1, quantity_remaining: 1.1, quantity_used: 1.1, + renewal_enabled: true, + renewal_period: "daily", source_label: "source_label", transfers: [ { @@ -2198,6 +2200,8 @@ describe("CreditsClient", () => { quantity: 1, quantityRemaining: 1.1, quantityUsed: 1.1, + renewalEnabled: true, + renewalPeriod: "daily", sourceLabel: "source_label", transfers: [ { @@ -2350,6 +2354,8 @@ describe("CreditsClient", () => { quantity: 1, quantity_remaining: 1.1, quantity_used: 1.1, + renewal_enabled: true, + renewal_period: "daily", source_label: "source_label", transfers: [ { @@ -2409,6 +2415,8 @@ describe("CreditsClient", () => { quantity: 1, quantityRemaining: 1.1, quantityUsed: 1.1, + renewalEnabled: true, + renewalPeriod: "daily", sourceLabel: "source_label", transfers: [ { @@ -2576,6 +2584,133 @@ describe("CreditsClient", () => { }).rejects.toThrow(Schematic.InternalServerError); }); + test("countCompanyGrants (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { count: 1 }, + params: { company_id: "company_id", dir: "asc", limit: 1, offset: 1, order: "created_at" }, + }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.countCompanyGrants({ + companyId: "company_id", + order: "created_at", + dir: "asc", + limit: 1, + offset: 1, + }); + expect(response).toEqual({ + data: { + count: 1, + }, + params: { + companyId: "company_id", + dir: "asc", + limit: 1, + offset: 1, + order: "created_at", + }, + }); + }); + + test("countCompanyGrants (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCompanyGrants(); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("countCompanyGrants (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCompanyGrants(); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("countCompanyGrants (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCompanyGrants(); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("countCompanyGrants (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCompanyGrants(); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("countCompanyGrants (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/billing/credits/grants/company/count") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCompanyGrants(); + }).rejects.toThrow(Schematic.InternalServerError); + }); + test("listCompanyGrants (1)", async () => { const server = mockServerPool.createServer(); const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); @@ -2606,6 +2741,8 @@ describe("CreditsClient", () => { quantity: 1, quantity_remaining: 1.1, quantity_used: 1.1, + renewal_enabled: true, + renewal_period: "daily", source_label: "source_label", transfers: [ { @@ -2666,6 +2803,8 @@ describe("CreditsClient", () => { quantity: 1, quantityRemaining: 1.1, quantityUsed: 1.1, + renewalEnabled: true, + renewalPeriod: "daily", sourceLabel: "source_label", transfers: [ { @@ -2937,6 +3076,8 @@ describe("CreditsClient", () => { quantity: 1, quantity_remaining: 1.1, quantity_used: 1.1, + renewal_enabled: true, + renewal_period: "daily", source_label: "source_label", transfers: [ { @@ -2995,6 +3136,8 @@ describe("CreditsClient", () => { quantity: 1, quantityRemaining: 1.1, quantityUsed: 1.1, + renewalEnabled: true, + renewalPeriod: "daily", sourceLabel: "source_label", transfers: [ { diff --git a/tests/wire/events.test.ts b/tests/wire/events.test.ts index 38d7d15b..476a5a21 100644 --- a/tests/wire/events.test.ts +++ b/tests/wire/events.test.ts @@ -11,14 +11,7 @@ describe("EventsClient", () => { const rawRequestBody = { events: [{ event_type: "flag_check" }] }; const rawResponseBody = { data: { - events: [ - { - captured_at: "2024-01-15T09:30:00Z", - remote_addr: "remote_addr", - remote_ip: "remote_ip", - user_agent: "user_agent", - }, - ], + events: [{ captured_at: "2024-01-15T09:30:00Z", remote_ip: "remote_ip", user_agent: "user_agent" }], }, params: { key: "value" }, }; @@ -43,7 +36,6 @@ describe("EventsClient", () => { events: [ { capturedAt: new Date("2024-01-15T09:30:00.000Z"), - remoteAddr: "remote_addr", remoteIp: "remote_ip", userAgent: "user_agent", }, @@ -312,20 +304,17 @@ describe("EventsClient", () => { captured_at: "2024-01-15T09:30:00Z", company: { id: "id", name: "name" }, company_id: "company_id", - enriched_at: "2024-01-15T09:30:00Z", environment_id: "environment_id", error_message: "error_message", feature_ids: ["feature_ids"], features: [{ id: "id", name: "name" }], id: "id", loaded_at: "2024-01-15T09:30:00Z", - processed_at: "2024-01-15T09:30:00Z", quantity: 1, sent_at: "2024-01-15T09:30:00Z", status: "enriched", subtype: "subtype", type: "flag_check", - updated_at: "2024-01-15T09:30:00Z", user: { id: "id", name: "name" }, user_id: "user_id", }, @@ -364,7 +353,6 @@ describe("EventsClient", () => { name: "name", }, companyId: "company_id", - enrichedAt: new Date("2024-01-15T09:30:00.000Z"), environmentId: "environment_id", errorMessage: "error_message", featureIds: ["feature_ids"], @@ -376,13 +364,11 @@ describe("EventsClient", () => { ], id: "id", loadedAt: new Date("2024-01-15T09:30:00.000Z"), - processedAt: new Date("2024-01-15T09:30:00.000Z"), quantity: 1, sentAt: new Date("2024-01-15T09:30:00.000Z"), status: "enriched", subtype: "subtype", type: "flag_check", - updatedAt: new Date("2024-01-15T09:30:00.000Z"), user: { id: "id", name: "name", @@ -619,20 +605,17 @@ describe("EventsClient", () => { captured_at: "2024-01-15T09:30:00Z", company: { description: "description", id: "id", image_url: "image_url", name: "name" }, company_id: "company_id", - enriched_at: "2024-01-15T09:30:00Z", environment_id: "environment_id", error_message: "error_message", feature_ids: ["feature_ids"], features: [{ id: "id", name: "name" }], id: "id", loaded_at: "2024-01-15T09:30:00Z", - processed_at: "2024-01-15T09:30:00Z", quantity: 1, sent_at: "2024-01-15T09:30:00Z", status: "enriched", subtype: "subtype", type: "flag_check", - updated_at: "2024-01-15T09:30:00Z", user: { description: "description", id: "id", image_url: "image_url", name: "name" }, user_id: "user_id", }, @@ -656,7 +639,6 @@ describe("EventsClient", () => { name: "name", }, companyId: "company_id", - enrichedAt: new Date("2024-01-15T09:30:00.000Z"), environmentId: "environment_id", errorMessage: "error_message", featureIds: ["feature_ids"], @@ -668,13 +650,11 @@ describe("EventsClient", () => { ], id: "id", loadedAt: new Date("2024-01-15T09:30:00.000Z"), - processedAt: new Date("2024-01-15T09:30:00.000Z"), quantity: 1, sentAt: new Date("2024-01-15T09:30:00.000Z"), status: "enriched", subtype: "subtype", type: "flag_check", - updatedAt: new Date("2024-01-15T09:30:00.000Z"), user: { description: "description", id: "id", diff --git a/tests/wire/planbundle.test.ts b/tests/wire/planbundle.test.ts new file mode 100644 index 00000000..79a89788 --- /dev/null +++ b/tests/wire/planbundle.test.ts @@ -0,0 +1,603 @@ +// This file was auto-generated by Fern from our API Definition. + +import * as Schematic from "../../src/api/index"; +import { SchematicClient } from "../../src/Client"; +import { mockServerPool } from "../mock-server/MockServerPool"; + +describe("PlanbundleClient", () => { + test("createPlanBundle (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }] }; + const rawResponseBody = { + data: { + billing_product: { + account_id: "account_id", + billing_product_id: "billing_product_id", + charge_type: "free", + controlled_by: "schematic", + environment_id: "environment_id", + is_trialable: true, + monthly_price_id: "monthly_price_id", + one_time_price_id: "one_time_price_id", + plan_id: "plan_id", + trial_days: 1, + yearly_price_id: "yearly_price_id", + }, + credit_grants: [ + { + auto_topup_enabled: true, + created_at: "2024-01-15T09:30:00Z", + credit_amount: 1, + credit_id: "credit_id", + credit_name: "credit_name", + id: "id", + plan_id: "plan_id", + plan_name: "plan_name", + reset_cadence: "daily", + reset_start: "billing_period", + updated_at: "2024-01-15T09:30:00Z", + }, + ], + entitlements: [ + { + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + feature_id: "feature_id", + id: "id", + plan_id: "plan_id", + rule_id: "rule_id", + updated_at: "2024-01-15T09:30:00Z", + value_type: "boolean", + }, + ], + plan: { + created_at: "2024-01-15T09:30:00Z", + description: "description", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + updated_at: "2024-01-15T09:30:00Z", + }, + traits: [ + { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + plan_id: "plan_id", + plan_type: "plan_type", + trait_id: "trait_id", + trait_value: "trait_value", + updated_at: "2024-01-15T09:30:00Z", + }, + ], + }, + params: { key: "value" }, + }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + ], + }); + expect(response).toEqual({ + data: { + billingProduct: { + accountId: "account_id", + billingProductId: "billing_product_id", + chargeType: "free", + controlledBy: "schematic", + environmentId: "environment_id", + isTrialable: true, + monthlyPriceId: "monthly_price_id", + oneTimePriceId: "one_time_price_id", + planId: "plan_id", + trialDays: 1, + yearlyPriceId: "yearly_price_id", + }, + creditGrants: [ + { + autoTopupEnabled: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + creditAmount: 1, + creditId: "credit_id", + creditName: "credit_name", + id: "id", + planId: "plan_id", + planName: "plan_name", + resetCadence: "daily", + resetStart: "billing_period", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + entitlements: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + featureId: "feature_id", + id: "id", + planId: "plan_id", + ruleId: "rule_id", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + valueType: "boolean", + }, + ], + plan: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + traits: [ + { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + planId: "plan_id", + planType: "plan_type", + traitId: "trait_id", + traitValue: "trait_value", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + params: { + key: "value", + }, + }); + }); + + test("createPlanBundle (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("createPlanBundle (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("createPlanBundle (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("createPlanBundle (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("createPlanBundle (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .post("/plan-bundles") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.createPlanBundle({ + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("updatePlanBundle (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }] }; + const rawResponseBody = { + data: { + billing_product: { + account_id: "account_id", + billing_product_id: "billing_product_id", + charge_type: "free", + controlled_by: "schematic", + environment_id: "environment_id", + is_trialable: true, + monthly_price_id: "monthly_price_id", + one_time_price_id: "one_time_price_id", + plan_id: "plan_id", + trial_days: 1, + yearly_price_id: "yearly_price_id", + }, + credit_grants: [ + { + auto_topup_enabled: true, + created_at: "2024-01-15T09:30:00Z", + credit_amount: 1, + credit_id: "credit_id", + credit_name: "credit_name", + id: "id", + plan_id: "plan_id", + plan_name: "plan_name", + reset_cadence: "daily", + reset_start: "billing_period", + updated_at: "2024-01-15T09:30:00Z", + }, + ], + entitlements: [ + { + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + feature_id: "feature_id", + id: "id", + plan_id: "plan_id", + rule_id: "rule_id", + updated_at: "2024-01-15T09:30:00Z", + value_type: "boolean", + }, + ], + plan: { + created_at: "2024-01-15T09:30:00Z", + description: "description", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + updated_at: "2024-01-15T09:30:00Z", + }, + traits: [ + { + account_id: "account_id", + created_at: "2024-01-15T09:30:00Z", + environment_id: "environment_id", + id: "id", + plan_id: "plan_id", + plan_type: "plan_type", + trait_id: "trait_id", + trait_value: "trait_value", + updated_at: "2024-01-15T09:30:00Z", + }, + ], + }, + params: { key: "value" }, + }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + ], + }); + expect(response).toEqual({ + data: { + billingProduct: { + accountId: "account_id", + billingProductId: "billing_product_id", + chargeType: "free", + controlledBy: "schematic", + environmentId: "environment_id", + isTrialable: true, + monthlyPriceId: "monthly_price_id", + oneTimePriceId: "one_time_price_id", + planId: "plan_id", + trialDays: 1, + yearlyPriceId: "yearly_price_id", + }, + creditGrants: [ + { + autoTopupEnabled: true, + createdAt: new Date("2024-01-15T09:30:00.000Z"), + creditAmount: 1, + creditId: "credit_id", + creditName: "credit_name", + id: "id", + planId: "plan_id", + planName: "plan_name", + resetCadence: "daily", + resetStart: "billing_period", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + entitlements: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + featureId: "feature_id", + id: "id", + planId: "plan_id", + ruleId: "rule_id", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + valueType: "boolean", + }, + ], + plan: { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + traits: [ + { + accountId: "account_id", + createdAt: new Date("2024-01-15T09:30:00.000Z"), + environmentId: "environment_id", + id: "id", + planId: "plan_id", + planType: "plan_type", + traitId: "trait_id", + traitValue: "trait_value", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + }, + ], + }, + params: { + key: "value", + }, + }); + }); + + test("updatePlanBundle (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("updatePlanBundle (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("updatePlanBundle (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("updatePlanBundle (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("updatePlanBundle (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + const rawRequestBody = { entitlements: [{ action: "create" }, { action: "create" }] }; + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .put("/plan-bundles/plan_bundle_id") + .jsonBody(rawRequestBody) + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.planbundle.updatePlanBundle("plan_bundle_id", { + entitlements: [ + { + action: "create", + }, + { + action: "create", + }, + ], + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); +}); diff --git a/tests/wire/plangroups.test.ts b/tests/wire/plangroups.test.ts index e73e3cd8..2251f130 100644 --- a/tests/wire/plangroups.test.ts +++ b/tests/wire/plangroups.test.ts @@ -113,6 +113,20 @@ describe("PlangroupsClient", () => { name: "name", plan_type: "plan", updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], }, ], checkout_settings: { collect_address: true, collect_email: true, collect_phone: true }, @@ -289,6 +303,20 @@ describe("PlangroupsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -464,6 +492,20 @@ describe("PlangroupsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -641,6 +683,20 @@ describe("PlangroupsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -782,6 +838,20 @@ describe("PlangroupsClient", () => { name: "name", plan_type: "plan", updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], }, ], prevent_downgrades_when_over_limit: true, @@ -961,6 +1031,20 @@ describe("PlangroupsClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1123,6 +1207,20 @@ describe("PlangroupsClient", () => { name: "name", planType: "plan", updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], }, ], checkoutSettings: { @@ -1322,6 +1420,20 @@ describe("PlangroupsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1512,6 +1624,20 @@ describe("PlangroupsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1704,6 +1830,20 @@ describe("PlangroupsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1872,6 +2012,20 @@ describe("PlangroupsClient", () => { name: "name", planType: "plan", updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], }, ], preventDowngradesWhenOverLimit: true, @@ -2066,6 +2220,20 @@ describe("PlangroupsClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", diff --git a/tests/wire/plans.test.ts b/tests/wire/plans.test.ts index 867664ee..81a9b2ba 100644 --- a/tests/wire/plans.test.ts +++ b/tests/wire/plans.test.ts @@ -895,6 +895,20 @@ describe("PlansClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1099,6 +1113,20 @@ describe("PlansClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1341,6 +1369,20 @@ describe("PlansClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -1533,6 +1575,20 @@ describe("PlansClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -1819,6 +1875,20 @@ describe("PlansClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -2000,6 +2070,20 @@ describe("PlansClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id", @@ -2219,6 +2303,20 @@ describe("PlansClient", () => { plan_type: "plan", trial_days: 1, updated_at: "2024-01-15T09:30:00Z", + versions: [ + { + created_at: "2024-01-15T09:30:00Z", + description: "description", + environment_id: "environment_id", + icon: "icon", + id: "id", + name: "name", + plan_type: "plan", + status: "published", + updated_at: "2024-01-15T09:30:00Z", + version: 1, + }, + ], yearly_price: { currency: "currency", external_price_id: "external_price_id", @@ -2409,6 +2507,20 @@ describe("PlansClient", () => { planType: "plan", trialDays: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), + versions: [ + { + createdAt: new Date("2024-01-15T09:30:00.000Z"), + description: "description", + environmentId: "environment_id", + icon: "icon", + id: "id", + name: "name", + planType: "plan", + status: "published", + updatedAt: new Date("2024-01-15T09:30:00.000Z"), + version: 1, + }, + ], yearlyPrice: { currency: "currency", externalPriceId: "external_price_id",