diff --git a/reference.md b/reference.md index fd6ad62e..4e3847c1 100644 --- a/reference.md +++ b/reference.md @@ -3416,6 +3416,122 @@ await client.credits.countBillingPlanCreditGrants({ + + + + +
client.credits.listCreditEventLedger({ ...params }) -> Schematic.ListCreditEventLedgerResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.credits.listCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1, + offset: 1 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.ListCreditEventLedgerRequest` + +
+
+ +
+
+ +**requestOptions:** `CreditsClient.RequestOptions` + +
+
+
+
+ + +
+
+
+ +
client.credits.countCreditEventLedger({ ...params }) -> Schematic.CountCreditEventLedgerResponse +
+
+ +#### 🔌 Usage + +
+
+ +
+
+ +```typescript +await client.credits.countCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1, + offset: 1 +}); + +``` +
+
+
+
+ +#### ⚙️ Parameters + +
+
+ +
+
+ +**request:** `Schematic.CountCreditEventLedgerRequest` + +
+
+ +
+
+ +**requestOptions:** `CreditsClient.RequestOptions` + +
+
+
+
+ +
@@ -9531,6 +9647,7 @@ await client.plangroups.createPlanGroup({ showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true @@ -9604,6 +9721,7 @@ await client.plangroups.updatePlanGroup("plan_group_id", { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true diff --git a/src/api/resources/billing/client/requests/CreateInvoiceRequestBody.ts b/src/api/resources/billing/client/requests/CreateInvoiceRequestBody.ts index a12823d7..5c5c966e 100644 --- a/src/api/resources/billing/client/requests/CreateInvoiceRequestBody.ts +++ b/src/api/resources/billing/client/requests/CreateInvoiceRequestBody.ts @@ -1,5 +1,7 @@ // This file was auto-generated by Fern from our API Definition. +import type * as Schematic from "../../../../index"; + /** * @example * { @@ -22,6 +24,7 @@ export interface CreateInvoiceRequestBody { dueDate?: Date; externalId?: string; paymentMethodExternalId?: string; + status?: Schematic.InvoiceStatus; subscriptionExternalId?: string; subtotal: number; url?: string; diff --git a/src/api/resources/credits/client/Client.ts b/src/api/resources/credits/client/Client.ts index 7637e34d..ac30a64e 100644 --- a/src/api/resources/credits/client/Client.ts +++ b/src/api/resources/credits/client/Client.ts @@ -3752,4 +3752,349 @@ export class CreditsClient { "/billing/credits/plan-grants/count", ); } + + /** + * @param {Schematic.ListCreditEventLedgerRequest} 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.listCreditEventLedger({ + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * endTime: "end_time", + * eventType: "grant", + * featureId: "feature_id", + * startTime: "start_time", + * limit: 1, + * offset: 1 + * }) + */ + public listCreditEventLedger( + request: Schematic.ListCreditEventLedgerRequest, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__listCreditEventLedger(request, requestOptions)); + } + + private async __listCreditEventLedger( + request: Schematic.ListCreditEventLedgerRequest, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { billingCreditId, companyId, endTime, eventType, featureId, startTime, limit, offset } = request; + const _queryParams: Record = {}; + if (billingCreditId != null) { + _queryParams.billing_credit_id = billingCreditId; + } + + _queryParams.company_id = companyId; + if (endTime != null) { + _queryParams.end_time = endTime; + } + + if (eventType != null) { + _queryParams.event_type = serializers.CreditEventType.jsonOrThrow(eventType, { + unrecognizedObjectKeys: "strip", + }); + } + + if (featureId != null) { + _queryParams.feature_id = featureId; + } + + if (startTime != null) { + _queryParams.start_time = startTime; + } + + 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, + "v2/billing/credits/ledger", + ), + 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.ListCreditEventLedgerResponse.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", "/v2/billing/credits/ledger"); + } + + /** + * @param {Schematic.CountCreditEventLedgerRequest} 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.countCreditEventLedger({ + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * endTime: "end_time", + * eventType: "grant", + * featureId: "feature_id", + * startTime: "start_time", + * limit: 1, + * offset: 1 + * }) + */ + public countCreditEventLedger( + request: Schematic.CountCreditEventLedgerRequest, + requestOptions?: CreditsClient.RequestOptions, + ): core.HttpResponsePromise { + return core.HttpResponsePromise.fromPromise(this.__countCreditEventLedger(request, requestOptions)); + } + + private async __countCreditEventLedger( + request: Schematic.CountCreditEventLedgerRequest, + requestOptions?: CreditsClient.RequestOptions, + ): Promise> { + const { billingCreditId, companyId, endTime, eventType, featureId, startTime, limit, offset } = request; + const _queryParams: Record = {}; + if (billingCreditId != null) { + _queryParams.billing_credit_id = billingCreditId; + } + + _queryParams.company_id = companyId; + if (endTime != null) { + _queryParams.end_time = endTime; + } + + if (eventType != null) { + _queryParams.event_type = serializers.CreditEventType.jsonOrThrow(eventType, { + unrecognizedObjectKeys: "strip", + }); + } + + if (featureId != null) { + _queryParams.feature_id = featureId; + } + + if (startTime != null) { + _queryParams.start_time = startTime; + } + + 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, + "v2/billing/credits/ledger/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.CountCreditEventLedgerResponse.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", + "/v2/billing/credits/ledger/count", + ); + } } diff --git a/src/api/resources/credits/client/requests/CountCreditEventLedgerRequest.ts b/src/api/resources/credits/client/requests/CountCreditEventLedgerRequest.ts new file mode 100644 index 00000000..e1679ffa --- /dev/null +++ b/src/api/resources/credits/client/requests/CountCreditEventLedgerRequest.ts @@ -0,0 +1,29 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * endTime: "end_time", + * eventType: "grant", + * featureId: "feature_id", + * startTime: "start_time", + * limit: 1, + * offset: 1 + * } + */ +export interface CountCreditEventLedgerRequest { + billingCreditId?: string; + companyId: string; + endTime?: string; + eventType?: Schematic.CreditEventType; + featureId?: string; + startTime?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; +} diff --git a/src/api/resources/credits/client/requests/ListCreditEventLedgerRequest.ts b/src/api/resources/credits/client/requests/ListCreditEventLedgerRequest.ts new file mode 100644 index 00000000..780d1c65 --- /dev/null +++ b/src/api/resources/credits/client/requests/ListCreditEventLedgerRequest.ts @@ -0,0 +1,29 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../../index"; + +/** + * @example + * { + * billingCreditId: "billing_credit_id", + * companyId: "company_id", + * endTime: "end_time", + * eventType: "grant", + * featureId: "feature_id", + * startTime: "start_time", + * limit: 1, + * offset: 1 + * } + */ +export interface ListCreditEventLedgerRequest { + billingCreditId?: string; + companyId: string; + endTime?: string; + eventType?: Schematic.CreditEventType; + featureId?: string; + startTime?: string; + /** 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 e044f025..6c4916bb 100644 --- a/src/api/resources/credits/client/requests/index.ts +++ b/src/api/resources/credits/client/requests/index.ts @@ -3,6 +3,7 @@ export type { CountBillingCreditsRequest } from "./CountBillingCreditsRequest"; export type { CountBillingPlanCreditGrantsRequest } from "./CountBillingPlanCreditGrantsRequest"; export type { CountCompanyGrantsRequest } from "./CountCompanyGrantsRequest"; export type { CountCreditBundlesRequest } from "./CountCreditBundlesRequest"; +export type { CountCreditEventLedgerRequest } from "./CountCreditEventLedgerRequest"; export type { CountCreditLedgerRequest } from "./CountCreditLedgerRequest"; export type { CreateBillingCreditRequestBody } from "./CreateBillingCreditRequestBody"; export type { CreateCompanyCreditGrant } from "./CreateCompanyCreditGrant"; @@ -13,6 +14,7 @@ export type { ListBillingCreditsRequest } from "./ListBillingCreditsRequest"; export type { ListBillingPlanCreditGrantsRequest } from "./ListBillingPlanCreditGrantsRequest"; export type { ListCompanyGrantsRequest } from "./ListCompanyGrantsRequest"; export type { ListCreditBundlesRequest } from "./ListCreditBundlesRequest"; +export type { ListCreditEventLedgerRequest } from "./ListCreditEventLedgerRequest"; export type { ListGrantsForCreditRequest } from "./ListGrantsForCreditRequest"; export type { UpdateBillingCreditRequestBody } from "./UpdateBillingCreditRequestBody"; export type { UpdateCreditBundleDetailsRequestBody } from "./UpdateCreditBundleDetailsRequestBody"; diff --git a/src/api/resources/credits/types/CountCreditEventLedgerParams.ts b/src/api/resources/credits/types/CountCreditEventLedgerParams.ts new file mode 100644 index 00000000..db8ad479 --- /dev/null +++ b/src/api/resources/credits/types/CountCreditEventLedgerParams.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface CountCreditEventLedgerParams { + billingCreditId?: string; + companyId?: string; + endTime?: string; + eventType?: Schematic.CreditEventType; + featureId?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + startTime?: string; +} diff --git a/src/api/resources/credits/types/CountCreditEventLedgerResponse.ts b/src/api/resources/credits/types/CountCreditEventLedgerResponse.ts new file mode 100644 index 00000000..5bbb6a70 --- /dev/null +++ b/src/api/resources/credits/types/CountCreditEventLedgerResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface CountCreditEventLedgerResponse { + data: Schematic.CountResponse; + /** Input parameters */ + params: Schematic.CountCreditEventLedgerParams; +} diff --git a/src/api/resources/credits/types/ListCreditEventLedgerParams.ts b/src/api/resources/credits/types/ListCreditEventLedgerParams.ts new file mode 100644 index 00000000..f95db196 --- /dev/null +++ b/src/api/resources/credits/types/ListCreditEventLedgerParams.ts @@ -0,0 +1,19 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +/** + * Input parameters + */ +export interface ListCreditEventLedgerParams { + billingCreditId?: string; + companyId?: string; + endTime?: string; + eventType?: Schematic.CreditEventType; + featureId?: string; + /** Page limit (default 100) */ + limit?: number; + /** Page offset (default 0) */ + offset?: number; + startTime?: string; +} diff --git a/src/api/resources/credits/types/ListCreditEventLedgerResponse.ts b/src/api/resources/credits/types/ListCreditEventLedgerResponse.ts new file mode 100644 index 00000000..d4eb60f2 --- /dev/null +++ b/src/api/resources/credits/types/ListCreditEventLedgerResponse.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../../../index"; + +export interface ListCreditEventLedgerResponse { + data: Schematic.CreditEventLedgerResponseData[]; + /** Input parameters */ + params: Schematic.ListCreditEventLedgerParams; +} diff --git a/src/api/resources/credits/types/index.ts b/src/api/resources/credits/types/index.ts index 96af477d..d659d72d 100644 --- a/src/api/resources/credits/types/index.ts +++ b/src/api/resources/credits/types/index.ts @@ -8,6 +8,8 @@ export * from "./CountCompanyGrantsParams"; export * from "./CountCompanyGrantsResponse"; export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; +export * from "./CountCreditEventLedgerParams"; +export * from "./CountCreditEventLedgerResponse"; export * from "./CountCreditLedgerParams"; export * from "./CountCreditLedgerResponse"; export * from "./CreateBillingCreditResponse"; @@ -29,6 +31,8 @@ export * from "./ListCompanyGrantsParams"; export * from "./ListCompanyGrantsResponse"; export * from "./ListCreditBundlesParams"; export * from "./ListCreditBundlesResponse"; +export * from "./ListCreditEventLedgerParams"; +export * from "./ListCreditEventLedgerResponse"; export * from "./ListGrantsForCreditParams"; export * from "./ListGrantsForCreditResponse"; export * from "./SoftDeleteBillingCreditResponse"; diff --git a/src/api/resources/plangroups/client/Client.ts b/src/api/resources/plangroups/client/Client.ts index 38b2e751..6a758d86 100644 --- a/src/api/resources/plangroups/client/Client.ts +++ b/src/api/resources/plangroups/client/Client.ts @@ -168,6 +168,7 @@ export class PlangroupsClient { * showAsMonthlyPrices: true, * showCredits: true, * showFeatureDescription: true, + * showHardLimit: true, * showPeriodToggle: true, * showZeroPriceAsFree: true, * syncCustomerBillingDetails: true @@ -324,6 +325,7 @@ export class PlangroupsClient { * showAsMonthlyPrices: true, * showCredits: true, * showFeatureDescription: true, + * showHardLimit: true, * showPeriodToggle: true, * showZeroPriceAsFree: true, * syncCustomerBillingDetails: true diff --git a/src/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts b/src/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts index b44bab71..e62a24de 100644 --- a/src/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts +++ b/src/api/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts @@ -25,6 +25,7 @@ import type * as Schematic from "../../../../index"; * showAsMonthlyPrices: true, * showCredits: true, * showFeatureDescription: true, + * showHardLimit: true, * showPeriodToggle: true, * showZeroPriceAsFree: true, * syncCustomerBillingDetails: true @@ -56,6 +57,7 @@ export interface CreatePlanGroupRequestBody { showAsMonthlyPrices: boolean; showCredits: boolean; showFeatureDescription: boolean; + showHardLimit: boolean; showPeriodToggle: boolean; showZeroPriceAsFree: boolean; syncCustomerBillingDetails: boolean; diff --git a/src/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts b/src/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts index 3536de2c..4abe12b2 100644 --- a/src/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts +++ b/src/api/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts @@ -25,6 +25,7 @@ import type * as Schematic from "../../../../index"; * showAsMonthlyPrices: true, * showCredits: true, * showFeatureDescription: true, + * showHardLimit: true, * showPeriodToggle: true, * showZeroPriceAsFree: true, * syncCustomerBillingDetails: true @@ -56,6 +57,7 @@ export interface UpdatePlanGroupRequestBody { showAsMonthlyPrices: boolean; showCredits: boolean; showFeatureDescription: boolean; + showHardLimit: boolean; showPeriodToggle: boolean; showZeroPriceAsFree: boolean; syncCustomerBillingDetails: boolean; diff --git a/src/api/types/ComponentDisplaySettings.ts b/src/api/types/ComponentDisplaySettings.ts index 10abd573..4e25a771 100644 --- a/src/api/types/ComponentDisplaySettings.ts +++ b/src/api/types/ComponentDisplaySettings.ts @@ -4,6 +4,7 @@ export interface ComponentDisplaySettings { showAsMonthlyPrices: boolean; showCredits: boolean; showFeatureDescription: boolean; + showHardLimit: boolean; showPeriodToggle: boolean; showZeroPriceAsFree: boolean; } diff --git a/src/api/types/ComponentSettingsResponseData.ts b/src/api/types/ComponentSettingsResponseData.ts index 2b4f850a..905a8564 100644 --- a/src/api/types/ComponentSettingsResponseData.ts +++ b/src/api/types/ComponentSettingsResponseData.ts @@ -4,6 +4,7 @@ export interface ComponentSettingsResponseData { showAsMonthlyPrices: boolean; showCredits: boolean; showFeatureDescription: boolean; + showHardLimit: boolean; showPeriodToggle: boolean; showZeroPriceAsFree: boolean; } diff --git a/src/api/types/CreditEventLedgerResponseData.ts b/src/api/types/CreditEventLedgerResponseData.ts new file mode 100644 index 00000000..5e0b6e91 --- /dev/null +++ b/src/api/types/CreditEventLedgerResponseData.ts @@ -0,0 +1,37 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Schematic from "../index"; + +export interface CreditEventLedgerResponseData { + amount: number; + autoTopupLogId?: string; + billingCreditBundleId?: string; + billingCreditId: string; + company?: Schematic.CompanyLedgerResponseData; + companyId: string; + credit?: Schematic.BillingCreditLedgerResponseData; + creditName: string; + environmentId: string; + eventAt: Date; + eventId: string; + eventType: Schematic.CreditEventType; + expiryType?: Schematic.BillingCreditExpiryType; + expiryUnit?: Schematic.BillingCreditExpiryUnit; + expiryUnitCount?: number; + feature?: Schematic.FeatureLedgerResponseData; + featureId?: string; + fromGrantId?: string; + grantExpiresAt?: Date; + grantId?: string; + grantQuantity?: number; + grantQuantityRemaining?: number; + grantReason?: Schematic.BillingCreditGrantReason; + grantValidFrom?: Date; + planId?: string; + quantityConsumed?: number; + quantityRemainingAtZeroOut?: number; + sourceId: number; + toGrantId?: string; + usageEventId?: string; + zeroedOutReason?: Schematic.BillingCreditGrantZeroedOutReason; +} diff --git a/src/api/types/CreditEventType.ts b/src/api/types/CreditEventType.ts new file mode 100644 index 00000000..f1608129 --- /dev/null +++ b/src/api/types/CreditEventType.ts @@ -0,0 +1,9 @@ +// This file was auto-generated by Fern from our API Definition. + +export const CreditEventType = { + Grant: "grant", + Transfer: "transfer", + Usage: "usage", + ZeroOut: "zero_out", +} as const; +export type CreditEventType = (typeof CreditEventType)[keyof typeof CreditEventType]; diff --git a/src/api/types/InvoiceRequestBody.ts b/src/api/types/InvoiceRequestBody.ts index d33cf07f..2b1967c6 100644 --- a/src/api/types/InvoiceRequestBody.ts +++ b/src/api/types/InvoiceRequestBody.ts @@ -1,5 +1,7 @@ // This file was auto-generated by Fern from our API Definition. +import type * as Schematic from "../index"; + export interface InvoiceRequestBody { amountDue: number; amountPaid: number; @@ -9,6 +11,7 @@ export interface InvoiceRequestBody { customerExternalId: string; dueDate?: Date; paymentMethodExternalId?: string; + status?: Schematic.InvoiceStatus; subscriptionExternalId?: string; subtotal: number; url?: string; diff --git a/src/api/types/InvoiceResponseData.ts b/src/api/types/InvoiceResponseData.ts index 5e160e0d..d4377c0f 100644 --- a/src/api/types/InvoiceResponseData.ts +++ b/src/api/types/InvoiceResponseData.ts @@ -17,6 +17,7 @@ export interface InvoiceResponseData { id: string; paymentMethodExternalId?: string; providerType: Schematic.BillingProviderType; + status?: Schematic.InvoiceStatus; subscriptionExternalId?: string; subtotal: number; updatedAt: Date; diff --git a/src/api/types/InvoiceStatus.ts b/src/api/types/InvoiceStatus.ts new file mode 100644 index 00000000..47667b17 --- /dev/null +++ b/src/api/types/InvoiceStatus.ts @@ -0,0 +1,10 @@ +// This file was auto-generated by Fern from our API Definition. + +export const InvoiceStatus = { + Draft: "draft", + Open: "open", + Paid: "paid", + Uncollectible: "uncollectible", + Void: "void", +} as const; +export type InvoiceStatus = (typeof InvoiceStatus)[keyof typeof InvoiceStatus]; diff --git a/src/api/types/index.ts b/src/api/types/index.ts index 4d6c6fc6..b7d76344 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -116,6 +116,8 @@ export * from "./CreatePriceTierRequestBody"; export * from "./CreditAutoTopupAmountType"; export * from "./CreditBundlePurchaseResponseData"; export * from "./CreditCompanyGrantView"; +export * from "./CreditEventLedgerResponseData"; +export * from "./CreditEventType"; export * from "./CreditGrantDetail"; export * from "./CreditGrantExpiryRequestBody"; export * from "./CreditGrantSortOrder"; @@ -187,6 +189,7 @@ export * from "./FlagView"; export * from "./GenericPreviewObject"; export * from "./InvoiceRequestBody"; export * from "./InvoiceResponseData"; +export * from "./InvoiceStatus"; export * from "./IssueTemporaryAccessTokenResponseData"; export * from "./KeysRequestBody"; export * from "./LimitTimeSeriesPointResponseData"; diff --git a/src/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.ts b/src/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.ts index 90b69c58..340a02de 100644 --- a/src/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.ts +++ b/src/serialization/resources/billing/client/requests/CreateInvoiceRequestBody.ts @@ -3,6 +3,7 @@ import type * as Schematic from "../../../../../api/index"; import * as core from "../../../../../core"; import type * as serializers from "../../../../index"; +import { InvoiceStatus } from "../../../../types/InvoiceStatus"; export const CreateInvoiceRequestBody: core.serialization.Schema< serializers.CreateInvoiceRequestBody.Raw, @@ -20,6 +21,7 @@ export const CreateInvoiceRequestBody: core.serialization.Schema< "payment_method_external_id", core.serialization.string().optional(), ), + status: InvoiceStatus.optional(), subscriptionExternalId: core.serialization.property( "subscription_external_id", core.serialization.string().optional(), @@ -39,6 +41,7 @@ export declare namespace CreateInvoiceRequestBody { due_date?: string | null; external_id?: string | null; payment_method_external_id?: string | null; + status?: InvoiceStatus.Raw | null; subscription_external_id?: string | null; subtotal: number; url?: string | null; diff --git a/src/serialization/resources/credits/types/CountCreditEventLedgerParams.ts b/src/serialization/resources/credits/types/CountCreditEventLedgerParams.ts new file mode 100644 index 00000000..a26c7402 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCreditEventLedgerParams.ts @@ -0,0 +1,33 @@ +// 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 { CreditEventType } from "../../../types/CreditEventType"; + +export const CountCreditEventLedgerParams: core.serialization.ObjectSchema< + serializers.CountCreditEventLedgerParams.Raw, + Schematic.CountCreditEventLedgerParams +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string().optional()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + endTime: core.serialization.property("end_time", core.serialization.string().optional()), + eventType: core.serialization.property("event_type", CreditEventType.optional()), + featureId: core.serialization.property("feature_id", core.serialization.string().optional()), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + startTime: core.serialization.property("start_time", core.serialization.string().optional()), +}); + +export declare namespace CountCreditEventLedgerParams { + export interface Raw { + billing_credit_id?: string | null; + company_id?: string | null; + end_time?: string | null; + event_type?: CreditEventType.Raw | null; + feature_id?: string | null; + limit?: number | null; + offset?: number | null; + start_time?: string | null; + } +} diff --git a/src/serialization/resources/credits/types/CountCreditEventLedgerResponse.ts b/src/serialization/resources/credits/types/CountCreditEventLedgerResponse.ts new file mode 100644 index 00000000..2b0ab029 --- /dev/null +++ b/src/serialization/resources/credits/types/CountCreditEventLedgerResponse.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 { CountCreditEventLedgerParams } from "./CountCreditEventLedgerParams"; + +export const CountCreditEventLedgerResponse: core.serialization.ObjectSchema< + serializers.CountCreditEventLedgerResponse.Raw, + Schematic.CountCreditEventLedgerResponse +> = core.serialization.object({ + data: CountResponse, + params: CountCreditEventLedgerParams, +}); + +export declare namespace CountCreditEventLedgerResponse { + export interface Raw { + data: CountResponse.Raw; + params: CountCreditEventLedgerParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/ListCreditEventLedgerParams.ts b/src/serialization/resources/credits/types/ListCreditEventLedgerParams.ts new file mode 100644 index 00000000..63fa517c --- /dev/null +++ b/src/serialization/resources/credits/types/ListCreditEventLedgerParams.ts @@ -0,0 +1,33 @@ +// 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 { CreditEventType } from "../../../types/CreditEventType"; + +export const ListCreditEventLedgerParams: core.serialization.ObjectSchema< + serializers.ListCreditEventLedgerParams.Raw, + Schematic.ListCreditEventLedgerParams +> = core.serialization.object({ + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string().optional()), + companyId: core.serialization.property("company_id", core.serialization.string().optional()), + endTime: core.serialization.property("end_time", core.serialization.string().optional()), + eventType: core.serialization.property("event_type", CreditEventType.optional()), + featureId: core.serialization.property("feature_id", core.serialization.string().optional()), + limit: core.serialization.number().optional(), + offset: core.serialization.number().optional(), + startTime: core.serialization.property("start_time", core.serialization.string().optional()), +}); + +export declare namespace ListCreditEventLedgerParams { + export interface Raw { + billing_credit_id?: string | null; + company_id?: string | null; + end_time?: string | null; + event_type?: CreditEventType.Raw | null; + feature_id?: string | null; + limit?: number | null; + offset?: number | null; + start_time?: string | null; + } +} diff --git a/src/serialization/resources/credits/types/ListCreditEventLedgerResponse.ts b/src/serialization/resources/credits/types/ListCreditEventLedgerResponse.ts new file mode 100644 index 00000000..3bdb4246 --- /dev/null +++ b/src/serialization/resources/credits/types/ListCreditEventLedgerResponse.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 { CreditEventLedgerResponseData } from "../../../types/CreditEventLedgerResponseData"; +import { ListCreditEventLedgerParams } from "./ListCreditEventLedgerParams"; + +export const ListCreditEventLedgerResponse: core.serialization.ObjectSchema< + serializers.ListCreditEventLedgerResponse.Raw, + Schematic.ListCreditEventLedgerResponse +> = core.serialization.object({ + data: core.serialization.list(CreditEventLedgerResponseData), + params: ListCreditEventLedgerParams, +}); + +export declare namespace ListCreditEventLedgerResponse { + export interface Raw { + data: CreditEventLedgerResponseData.Raw[]; + params: ListCreditEventLedgerParams.Raw; + } +} diff --git a/src/serialization/resources/credits/types/index.ts b/src/serialization/resources/credits/types/index.ts index 96af477d..d659d72d 100644 --- a/src/serialization/resources/credits/types/index.ts +++ b/src/serialization/resources/credits/types/index.ts @@ -8,6 +8,8 @@ export * from "./CountCompanyGrantsParams"; export * from "./CountCompanyGrantsResponse"; export * from "./CountCreditBundlesParams"; export * from "./CountCreditBundlesResponse"; +export * from "./CountCreditEventLedgerParams"; +export * from "./CountCreditEventLedgerResponse"; export * from "./CountCreditLedgerParams"; export * from "./CountCreditLedgerResponse"; export * from "./CreateBillingCreditResponse"; @@ -29,6 +31,8 @@ export * from "./ListCompanyGrantsParams"; export * from "./ListCompanyGrantsResponse"; export * from "./ListCreditBundlesParams"; export * from "./ListCreditBundlesResponse"; +export * from "./ListCreditEventLedgerParams"; +export * from "./ListCreditEventLedgerResponse"; export * from "./ListGrantsForCreditParams"; export * from "./ListGrantsForCreditResponse"; export * from "./SoftDeleteBillingCreditResponse"; diff --git a/src/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts b/src/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts index 4e9c07a3..b384b71e 100644 --- a/src/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts +++ b/src/serialization/resources/plangroups/client/requests/CreatePlanGroupRequestBody.ts @@ -62,6 +62,7 @@ export const CreatePlanGroupRequestBody: core.serialization.Schema< showAsMonthlyPrices: core.serialization.property("show_as_monthly_prices", core.serialization.boolean()), showCredits: core.serialization.property("show_credits", core.serialization.boolean()), showFeatureDescription: core.serialization.property("show_feature_description", core.serialization.boolean()), + showHardLimit: core.serialization.property("show_hard_limit", core.serialization.boolean()), showPeriodToggle: core.serialization.property("show_period_toggle", core.serialization.boolean()), showZeroPriceAsFree: core.serialization.property("show_zero_price_as_free", core.serialization.boolean()), syncCustomerBillingDetails: core.serialization.property( @@ -106,6 +107,7 @@ export declare namespace CreatePlanGroupRequestBody { show_as_monthly_prices: boolean; show_credits: boolean; show_feature_description: boolean; + show_hard_limit: boolean; show_period_toggle: boolean; show_zero_price_as_free: boolean; sync_customer_billing_details: boolean; diff --git a/src/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts b/src/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts index a9eade78..c1b7ec2e 100644 --- a/src/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts +++ b/src/serialization/resources/plangroups/client/requests/UpdatePlanGroupRequestBody.ts @@ -62,6 +62,7 @@ export const UpdatePlanGroupRequestBody: core.serialization.Schema< showAsMonthlyPrices: core.serialization.property("show_as_monthly_prices", core.serialization.boolean()), showCredits: core.serialization.property("show_credits", core.serialization.boolean()), showFeatureDescription: core.serialization.property("show_feature_description", core.serialization.boolean()), + showHardLimit: core.serialization.property("show_hard_limit", core.serialization.boolean()), showPeriodToggle: core.serialization.property("show_period_toggle", core.serialization.boolean()), showZeroPriceAsFree: core.serialization.property("show_zero_price_as_free", core.serialization.boolean()), syncCustomerBillingDetails: core.serialization.property( @@ -106,6 +107,7 @@ export declare namespace UpdatePlanGroupRequestBody { show_as_monthly_prices: boolean; show_credits: boolean; show_feature_description: boolean; + show_hard_limit: boolean; show_period_toggle: boolean; show_zero_price_as_free: boolean; sync_customer_billing_details: boolean; diff --git a/src/serialization/types/ComponentDisplaySettings.ts b/src/serialization/types/ComponentDisplaySettings.ts index a178a9f7..7960ee50 100644 --- a/src/serialization/types/ComponentDisplaySettings.ts +++ b/src/serialization/types/ComponentDisplaySettings.ts @@ -11,6 +11,7 @@ export const ComponentDisplaySettings: core.serialization.ObjectSchema< showAsMonthlyPrices: core.serialization.property("show_as_monthly_prices", core.serialization.boolean()), showCredits: core.serialization.property("show_credits", core.serialization.boolean()), showFeatureDescription: core.serialization.property("show_feature_description", core.serialization.boolean()), + showHardLimit: core.serialization.property("show_hard_limit", core.serialization.boolean()), showPeriodToggle: core.serialization.property("show_period_toggle", core.serialization.boolean()), showZeroPriceAsFree: core.serialization.property("show_zero_price_as_free", core.serialization.boolean()), }); @@ -20,6 +21,7 @@ export declare namespace ComponentDisplaySettings { show_as_monthly_prices: boolean; show_credits: boolean; show_feature_description: boolean; + show_hard_limit: boolean; show_period_toggle: boolean; show_zero_price_as_free: boolean; } diff --git a/src/serialization/types/ComponentSettingsResponseData.ts b/src/serialization/types/ComponentSettingsResponseData.ts index 22aa0be6..fcca2f43 100644 --- a/src/serialization/types/ComponentSettingsResponseData.ts +++ b/src/serialization/types/ComponentSettingsResponseData.ts @@ -11,6 +11,7 @@ export const ComponentSettingsResponseData: core.serialization.ObjectSchema< showAsMonthlyPrices: core.serialization.property("show_as_monthly_prices", core.serialization.boolean()), showCredits: core.serialization.property("show_credits", core.serialization.boolean()), showFeatureDescription: core.serialization.property("show_feature_description", core.serialization.boolean()), + showHardLimit: core.serialization.property("show_hard_limit", core.serialization.boolean()), showPeriodToggle: core.serialization.property("show_period_toggle", core.serialization.boolean()), showZeroPriceAsFree: core.serialization.property("show_zero_price_as_free", core.serialization.boolean()), }); @@ -20,6 +21,7 @@ export declare namespace ComponentSettingsResponseData { show_as_monthly_prices: boolean; show_credits: boolean; show_feature_description: boolean; + show_hard_limit: boolean; show_period_toggle: boolean; show_zero_price_as_free: boolean; } diff --git a/src/serialization/types/CreditEventLedgerResponseData.ts b/src/serialization/types/CreditEventLedgerResponseData.ts new file mode 100644 index 00000000..72fbeb2f --- /dev/null +++ b/src/serialization/types/CreditEventLedgerResponseData.ts @@ -0,0 +1,95 @@ +// 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 "./BillingCreditExpiryType"; +import { BillingCreditExpiryUnit } from "./BillingCreditExpiryUnit"; +import { BillingCreditGrantReason } from "./BillingCreditGrantReason"; +import { BillingCreditGrantZeroedOutReason } from "./BillingCreditGrantZeroedOutReason"; +import { BillingCreditLedgerResponseData } from "./BillingCreditLedgerResponseData"; +import { CompanyLedgerResponseData } from "./CompanyLedgerResponseData"; +import { CreditEventType } from "./CreditEventType"; +import { FeatureLedgerResponseData } from "./FeatureLedgerResponseData"; + +export const CreditEventLedgerResponseData: core.serialization.ObjectSchema< + serializers.CreditEventLedgerResponseData.Raw, + Schematic.CreditEventLedgerResponseData +> = core.serialization.object({ + amount: core.serialization.number(), + autoTopupLogId: core.serialization.property("auto_topup_log_id", core.serialization.string().optional()), + billingCreditBundleId: core.serialization.property( + "billing_credit_bundle_id", + core.serialization.string().optional(), + ), + billingCreditId: core.serialization.property("billing_credit_id", core.serialization.string()), + company: CompanyLedgerResponseData.optional(), + companyId: core.serialization.property("company_id", core.serialization.string()), + credit: BillingCreditLedgerResponseData.optional(), + creditName: core.serialization.property("credit_name", core.serialization.string()), + environmentId: core.serialization.property("environment_id", core.serialization.string()), + eventAt: core.serialization.property("event_at", core.serialization.date()), + eventId: core.serialization.property("event_id", core.serialization.string()), + eventType: core.serialization.property("event_type", CreditEventType), + expiryType: core.serialization.property("expiry_type", BillingCreditExpiryType.optional()), + expiryUnit: core.serialization.property("expiry_unit", BillingCreditExpiryUnit.optional()), + expiryUnitCount: core.serialization.property("expiry_unit_count", core.serialization.number().optional()), + feature: FeatureLedgerResponseData.optional(), + featureId: core.serialization.property("feature_id", core.serialization.string().optional()), + fromGrantId: core.serialization.property("from_grant_id", core.serialization.string().optional()), + grantExpiresAt: core.serialization.property("grant_expires_at", core.serialization.date().optional()), + grantId: core.serialization.property("grant_id", core.serialization.string().optional()), + grantQuantity: core.serialization.property("grant_quantity", core.serialization.number().optional()), + grantQuantityRemaining: core.serialization.property( + "grant_quantity_remaining", + core.serialization.number().optional(), + ), + grantReason: core.serialization.property("grant_reason", BillingCreditGrantReason.optional()), + grantValidFrom: core.serialization.property("grant_valid_from", core.serialization.date().optional()), + planId: core.serialization.property("plan_id", core.serialization.string().optional()), + quantityConsumed: core.serialization.property("quantity_consumed", core.serialization.number().optional()), + quantityRemainingAtZeroOut: core.serialization.property( + "quantity_remaining_at_zero_out", + core.serialization.number().optional(), + ), + sourceId: core.serialization.property("source_id", core.serialization.number()), + toGrantId: core.serialization.property("to_grant_id", core.serialization.string().optional()), + usageEventId: core.serialization.property("usage_event_id", core.serialization.string().optional()), + zeroedOutReason: core.serialization.property("zeroed_out_reason", BillingCreditGrantZeroedOutReason.optional()), +}); + +export declare namespace CreditEventLedgerResponseData { + export interface Raw { + amount: number; + auto_topup_log_id?: string | null; + billing_credit_bundle_id?: string | null; + billing_credit_id: string; + company?: CompanyLedgerResponseData.Raw | null; + company_id: string; + credit?: BillingCreditLedgerResponseData.Raw | null; + credit_name: string; + environment_id: string; + event_at: string; + event_id: string; + event_type: CreditEventType.Raw; + expiry_type?: BillingCreditExpiryType.Raw | null; + expiry_unit?: BillingCreditExpiryUnit.Raw | null; + expiry_unit_count?: number | null; + feature?: FeatureLedgerResponseData.Raw | null; + feature_id?: string | null; + from_grant_id?: string | null; + grant_expires_at?: string | null; + grant_id?: string | null; + grant_quantity?: number | null; + grant_quantity_remaining?: number | null; + grant_reason?: BillingCreditGrantReason.Raw | null; + grant_valid_from?: string | null; + plan_id?: string | null; + quantity_consumed?: number | null; + quantity_remaining_at_zero_out?: number | null; + source_id: number; + to_grant_id?: string | null; + usage_event_id?: string | null; + zeroed_out_reason?: BillingCreditGrantZeroedOutReason.Raw | null; + } +} diff --git a/src/serialization/types/CreditEventType.ts b/src/serialization/types/CreditEventType.ts new file mode 100644 index 00000000..317d479a --- /dev/null +++ b/src/serialization/types/CreditEventType.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 CreditEventType: core.serialization.Schema = + core.serialization.enum_(["grant", "transfer", "usage", "zero_out"]); + +export declare namespace CreditEventType { + export type Raw = "grant" | "transfer" | "usage" | "zero_out"; +} diff --git a/src/serialization/types/InvoiceRequestBody.ts b/src/serialization/types/InvoiceRequestBody.ts index 343a182c..b82063a8 100644 --- a/src/serialization/types/InvoiceRequestBody.ts +++ b/src/serialization/types/InvoiceRequestBody.ts @@ -3,6 +3,7 @@ import type * as Schematic from "../../api/index"; import * as core from "../../core"; import type * as serializers from "../index"; +import { InvoiceStatus } from "./InvoiceStatus"; export const InvoiceRequestBody: core.serialization.ObjectSchema< serializers.InvoiceRequestBody.Raw, @@ -19,6 +20,7 @@ export const InvoiceRequestBody: core.serialization.ObjectSchema< "payment_method_external_id", core.serialization.string().optional(), ), + status: InvoiceStatus.optional(), subscriptionExternalId: core.serialization.property( "subscription_external_id", core.serialization.string().optional(), @@ -37,6 +39,7 @@ export declare namespace InvoiceRequestBody { customer_external_id: string; due_date?: string | null; payment_method_external_id?: string | null; + status?: InvoiceStatus.Raw | null; subscription_external_id?: string | null; subtotal: number; url?: string | null; diff --git a/src/serialization/types/InvoiceResponseData.ts b/src/serialization/types/InvoiceResponseData.ts index c5b657e3..51f10cc9 100644 --- a/src/serialization/types/InvoiceResponseData.ts +++ b/src/serialization/types/InvoiceResponseData.ts @@ -4,6 +4,7 @@ import type * as Schematic from "../../api/index"; import * as core from "../../core"; import type * as serializers from "../index"; import { BillingProviderType } from "./BillingProviderType"; +import { InvoiceStatus } from "./InvoiceStatus"; export const InvoiceResponseData: core.serialization.ObjectSchema< serializers.InvoiceResponseData.Raw, @@ -26,6 +27,7 @@ export const InvoiceResponseData: core.serialization.ObjectSchema< core.serialization.string().optional(), ), providerType: core.serialization.property("provider_type", BillingProviderType), + status: InvoiceStatus.optional(), subscriptionExternalId: core.serialization.property( "subscription_external_id", core.serialization.string().optional(), @@ -51,6 +53,7 @@ export declare namespace InvoiceResponseData { id: string; payment_method_external_id?: string | null; provider_type: BillingProviderType.Raw; + status?: InvoiceStatus.Raw | null; subscription_external_id?: string | null; subtotal: number; updated_at: string; diff --git a/src/serialization/types/InvoiceStatus.ts b/src/serialization/types/InvoiceStatus.ts new file mode 100644 index 00000000..cfd6760e --- /dev/null +++ b/src/serialization/types/InvoiceStatus.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 InvoiceStatus: core.serialization.Schema = + core.serialization.enum_(["draft", "open", "paid", "uncollectible", "void"]); + +export declare namespace InvoiceStatus { + export type Raw = "draft" | "open" | "paid" | "uncollectible" | "void"; +} diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts index 4d6c6fc6..b7d76344 100644 --- a/src/serialization/types/index.ts +++ b/src/serialization/types/index.ts @@ -116,6 +116,8 @@ export * from "./CreatePriceTierRequestBody"; export * from "./CreditAutoTopupAmountType"; export * from "./CreditBundlePurchaseResponseData"; export * from "./CreditCompanyGrantView"; +export * from "./CreditEventLedgerResponseData"; +export * from "./CreditEventType"; export * from "./CreditGrantDetail"; export * from "./CreditGrantExpiryRequestBody"; export * from "./CreditGrantSortOrder"; @@ -187,6 +189,7 @@ export * from "./FlagView"; export * from "./GenericPreviewObject"; export * from "./InvoiceRequestBody"; export * from "./InvoiceResponseData"; +export * from "./InvoiceStatus"; export * from "./IssueTemporaryAccessTokenResponseData"; export * from "./KeysRequestBody"; export * from "./LimitTimeSeriesPointResponseData"; diff --git a/tests/unit/wrapper.test.ts b/tests/unit/wrapper.test.ts deleted file mode 100644 index c730dae7..00000000 --- a/tests/unit/wrapper.test.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { SchematicClient, CheckFlagWithEntitlementResponse } from '../../src/wrapper'; -import * as api from '../../src/api'; - -// Mock the DataStreamClient module -jest.mock('../../src/datastream', () => { - return { - DataStreamClient: jest.fn().mockImplementation(() => ({ - start: jest.fn().mockResolvedValue(undefined), - close: jest.fn(), - isConnected: jest.fn().mockReturnValue(true), - checkFlag: jest.fn(), - })), - }; -}); - -describe('SchematicClient', () => { - afterEach(() => { - jest.restoreAllMocks(); - }); - - describe('checkFlag', () => { - it('should return a boolean in offline mode', async () => { - const client = new SchematicClient({ - offline: true, - flagDefaults: { 'test-flag': true }, - }); - - const result = await client.checkFlag({}, 'test-flag'); - expect(typeof result).toBe('boolean'); - expect(result).toBe(true); - - await client.close(); - }); - - it('should return false by default in offline mode', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlag({}, 'unknown-flag'); - expect(result).toBe(false); - - await client.close(); - }); - - it('should use custom defaultValue option', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlag({}, 'some-flag', { defaultValue: true }); - expect(result).toBe(true); - - await client.close(); - }); - - it('should use defaultValue function option', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlag({}, 'some-flag', { - defaultValue: () => true, - }); - expect(result).toBe(true); - - await client.close(); - }); - }); - - describe('checkFlagWithEntitlement', () => { - it('should return a CheckFlagWithEntitlementResponse in offline mode', async () => { - const client = new SchematicClient({ - offline: true, - flagDefaults: { 'test-flag': true }, - }); - - const result = await client.checkFlagWithEntitlement({}, 'test-flag'); - expect(result).toEqual({ - flagKey: 'test-flag', - reason: 'flag default', - value: true, - }); - - await client.close(); - }); - - it('should return default value false when no flag defaults set', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlagWithEntitlement({}, 'unknown-flag'); - expect(result.value).toBe(false); - expect(result.flagKey).toBe('unknown-flag'); - - await client.close(); - }); - - it('should use custom defaultValue option', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlagWithEntitlement({}, 'some-flag', { - defaultValue: true, - }); - expect(result.value).toBe(true); - expect(result.flagKey).toBe('some-flag'); - - await client.close(); - }); - - it('should not include entitlement in offline mode response', async () => { - const client = new SchematicClient({ offline: true }); - - const result = await client.checkFlagWithEntitlement({}, 'test-flag'); - expect(result.entitlement).toBeUndefined(); - - await client.close(); - }); - - it('should not include deprecated feature* fields', async () => { - const client = new SchematicClient({ offline: true }); - - const result: CheckFlagWithEntitlementResponse = await client.checkFlagWithEntitlement( - {}, - 'test-flag', - ); - - // Verify the response type does not have deprecated fields - expect(result).not.toHaveProperty('featureAllocation'); - expect(result).not.toHaveProperty('featureUsage'); - expect(result).not.toHaveProperty('featureUsageEvent'); - expect(result).not.toHaveProperty('featureUsagePeriod'); - expect(result).not.toHaveProperty('featureUsageResetAt'); - - await client.close(); - }); - }); -}); diff --git a/tests/wire/billing.test.ts b/tests/wire/billing.test.ts index bc9d3bc2..7e6ebe8c 100644 --- a/tests/wire/billing.test.ts +++ b/tests/wire/billing.test.ts @@ -875,6 +875,7 @@ describe("BillingClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -915,6 +916,7 @@ describe("BillingClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), @@ -1034,6 +1036,7 @@ describe("BillingClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -1075,6 +1078,7 @@ describe("BillingClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/checkout.test.ts b/tests/wire/checkout.test.ts index 1d055a14..fe3645c4 100644 --- a/tests/wire/checkout.test.ts +++ b/tests/wire/checkout.test.ts @@ -4861,6 +4861,7 @@ describe("CheckoutClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -4969,6 +4970,7 @@ describe("CheckoutClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/companies.test.ts b/tests/wire/companies.test.ts index 80fc6b46..4afaf62e 100644 --- a/tests/wire/companies.test.ts +++ b/tests/wire/companies.test.ts @@ -3759,6 +3759,7 @@ describe("CompaniesClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -3932,6 +3933,7 @@ describe("CompaniesClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -4104,6 +4106,7 @@ describe("CompaniesClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -5352,6 +5355,7 @@ describe("CompaniesClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), @@ -5529,6 +5533,7 @@ describe("CompaniesClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), @@ -5705,6 +5710,7 @@ describe("CompaniesClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/components.test.ts b/tests/wire/components.test.ts index df2d29f1..7342968a 100644 --- a/tests/wire/components.test.ts +++ b/tests/wire/components.test.ts @@ -1519,6 +1519,7 @@ describe("ComponentsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, }, @@ -1851,6 +1852,7 @@ describe("ComponentsClient", () => { id: "id", payment_method_external_id: "payment_method_external_id", provider_type: "schematic", + status: "draft", subscription_external_id: "subscription_external_id", subtotal: 1, updated_at: "2024-01-15T09:30:00Z", @@ -2738,6 +2740,7 @@ describe("ComponentsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, }, @@ -3085,6 +3088,7 @@ describe("ComponentsClient", () => { id: "id", paymentMethodExternalId: "payment_method_external_id", providerType: "schematic", + status: "draft", subscriptionExternalId: "subscription_external_id", subtotal: 1, updatedAt: new Date("2024-01-15T09:30:00.000Z"), diff --git a/tests/wire/componentspublic.test.ts b/tests/wire/componentspublic.test.ts index a077afd3..bdbafe96 100644 --- a/tests/wire/componentspublic.test.ts +++ b/tests/wire/componentspublic.test.ts @@ -285,6 +285,7 @@ describe("ComponentspublicClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, }, @@ -610,6 +611,7 @@ describe("ComponentspublicClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, }, diff --git a/tests/wire/credits.test.ts b/tests/wire/credits.test.ts index 7a8d5eaf..d06f2552 100644 --- a/tests/wire/credits.test.ts +++ b/tests/wire/credits.test.ts @@ -4683,4 +4683,383 @@ describe("CreditsClient", () => { return await client.credits.countBillingPlanCreditGrants(); }).rejects.toThrow(Schematic.InternalServerError); }); + + test("listCreditEventLedger (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: [ + { + amount: 1.1, + auto_topup_log_id: "auto_topup_log_id", + billing_credit_bundle_id: "billing_credit_bundle_id", + billing_credit_id: "billing_credit_id", + company: { id: "id", name: "name" }, + company_id: "company_id", + credit: { id: "id", name: "name" }, + credit_name: "credit_name", + environment_id: "environment_id", + event_at: "2024-01-15T09:30:00Z", + event_id: "event_id", + event_type: "grant", + expiry_type: "duration", + expiry_unit: "billing_periods", + expiry_unit_count: 1, + feature: { id: "id", name: "name" }, + feature_id: "feature_id", + from_grant_id: "from_grant_id", + grant_expires_at: "2024-01-15T09:30:00Z", + grant_id: "grant_id", + grant_quantity: 1, + grant_quantity_remaining: 1.1, + grant_reason: "billing_credit_auto_topup", + grant_valid_from: "2024-01-15T09:30:00Z", + plan_id: "plan_id", + quantity_consumed: 1.1, + quantity_remaining_at_zero_out: 1.1, + source_id: 1, + to_grant_id: "to_grant_id", + usage_event_id: "usage_event_id", + zeroed_out_reason: "expired", + }, + ], + params: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + end_time: "end_time", + event_type: "grant", + feature_id: "feature_id", + limit: 1, + offset: 1, + start_time: "start_time", + }, + }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.listCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1, + offset: 1, + }); + expect(response).toEqual({ + data: [ + { + amount: 1.1, + autoTopupLogId: "auto_topup_log_id", + billingCreditBundleId: "billing_credit_bundle_id", + billingCreditId: "billing_credit_id", + company: { + id: "id", + name: "name", + }, + companyId: "company_id", + credit: { + id: "id", + name: "name", + }, + creditName: "credit_name", + environmentId: "environment_id", + eventAt: new Date("2024-01-15T09:30:00.000Z"), + eventId: "event_id", + eventType: "grant", + expiryType: "duration", + expiryUnit: "billing_periods", + expiryUnitCount: 1, + feature: { + id: "id", + name: "name", + }, + featureId: "feature_id", + fromGrantId: "from_grant_id", + grantExpiresAt: new Date("2024-01-15T09:30:00.000Z"), + grantId: "grant_id", + grantQuantity: 1, + grantQuantityRemaining: 1.1, + grantReason: "billing_credit_auto_topup", + grantValidFrom: new Date("2024-01-15T09:30:00.000Z"), + planId: "plan_id", + quantityConsumed: 1.1, + quantityRemainingAtZeroOut: 1.1, + sourceId: 1, + toGrantId: "to_grant_id", + usageEventId: "usage_event_id", + zeroedOutReason: "expired", + }, + ], + params: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + limit: 1, + offset: 1, + startTime: "start_time", + }, + }); + }); + + test("listCreditEventLedger (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("listCreditEventLedger (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("listCreditEventLedger (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("listCreditEventLedger (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("listCreditEventLedger (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.listCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); + + test("countCreditEventLedger (1)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { + data: { count: 1 }, + params: { + billing_credit_id: "billing_credit_id", + company_id: "company_id", + end_time: "end_time", + event_type: "grant", + feature_id: "feature_id", + limit: 1, + offset: 1, + start_time: "start_time", + }, + }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(200) + .jsonBody(rawResponseBody) + .build(); + + const response = await client.credits.countCreditEventLedger({ + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + startTime: "start_time", + limit: 1, + offset: 1, + }); + expect(response).toEqual({ + data: { + count: 1, + }, + params: { + billingCreditId: "billing_credit_id", + companyId: "company_id", + endTime: "end_time", + eventType: "grant", + featureId: "feature_id", + limit: 1, + offset: 1, + startTime: "start_time", + }, + }); + }); + + test("countCreditEventLedger (2)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(400) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.BadRequestError); + }); + + test("countCreditEventLedger (3)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(401) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.UnauthorizedError); + }); + + test("countCreditEventLedger (4)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(403) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.ForbiddenError); + }); + + test("countCreditEventLedger (5)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(404) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.NotFoundError); + }); + + test("countCreditEventLedger (6)", async () => { + const server = mockServerPool.createServer(); + const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl }); + + const rawResponseBody = { error: "error" }; + server + .mockEndpoint() + .get("/v2/billing/credits/ledger/count") + .respondWith() + .statusCode(500) + .jsonBody(rawResponseBody) + .build(); + + await expect(async () => { + return await client.credits.countCreditEventLedger({ + companyId: "company_id", + }); + }).rejects.toThrow(Schematic.InternalServerError); + }); }); diff --git a/tests/wire/plangroups.test.ts b/tests/wire/plangroups.test.ts index 932917f9..1428c01f 100644 --- a/tests/wire/plangroups.test.ts +++ b/tests/wire/plangroups.test.ts @@ -134,6 +134,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, }, @@ -1323,6 +1324,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, }, @@ -2526,6 +2528,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -2541,6 +2544,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, }, @@ -2606,6 +2610,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -2628,6 +2633,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, }, @@ -2687,6 +2693,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -2738,6 +2745,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -2763,6 +2771,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -2814,6 +2823,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -2839,6 +2849,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -2890,6 +2901,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -2915,6 +2927,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -2966,6 +2979,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -2991,6 +3005,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3042,6 +3057,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3067,6 +3083,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3082,6 +3099,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, }, @@ -3147,6 +3165,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3169,6 +3188,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, }, @@ -3228,6 +3248,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3279,6 +3300,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3304,6 +3326,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3355,6 +3378,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3380,6 +3404,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3431,6 +3456,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3456,6 +3482,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3507,6 +3534,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true, @@ -3532,6 +3560,7 @@ describe("PlangroupsClient", () => { show_as_monthly_prices: true, show_credits: true, show_feature_description: true, + show_hard_limit: true, show_period_toggle: true, show_zero_price_as_free: true, sync_customer_billing_details: true, @@ -3583,6 +3612,7 @@ describe("PlangroupsClient", () => { showAsMonthlyPrices: true, showCredits: true, showFeatureDescription: true, + showHardLimit: true, showPeriodToggle: true, showZeroPriceAsFree: true, syncCustomerBillingDetails: true,