From d048a4f7cfb19190f8bcbf8d03befe501303c61e Mon Sep 17 00:00:00 2001
From: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Date: Mon, 22 Jun 2026 18:47:45 +0000
Subject: [PATCH] [fern-generated] Update SDK
Generated by Fern
CLI Version: unknown
Generators:
- fernapi/fern-typescript-node-sdk: 3.70.7
---
.fern/metadata.json | 6 +-
package.json | 2 +-
reference.md | 206 +++++++++
src/BaseClient.ts | 4 +-
src/api/resources/billing/client/Client.ts | 399 ++++++++++++++++++
.../types/DeleteBillingCouponResponse.ts | 9 +
.../types/DeleteBillingCustomerResponse.ts | 9 +
.../types/DeleteBillingInvoiceResponse.ts | 9 +
src/api/resources/billing/types/index.ts | 3 +
src/api/resources/webhooks/client/Client.ts | 136 ++++++
.../client/requests/TestWebhookRequestBody.ts | 13 +
.../webhooks/client/requests/index.ts | 1 +
.../types/SendTestWebhookActionResponse.ts | 9 +
src/api/resources/webhooks/types/index.ts | 1 +
src/api/types/TestWebhookResponseData.ts | 6 +
src/api/types/index.ts | 1 +
.../types/DeleteBillingCouponResponse.ts | 21 +
.../types/DeleteBillingCustomerResponse.ts | 21 +
.../types/DeleteBillingInvoiceResponse.ts | 21 +
.../resources/billing/types/index.ts | 3 +
.../client/requests/TestWebhookRequestBody.ts | 19 +
.../webhooks/client/requests/index.ts | 1 +
.../types/SendTestWebhookActionResponse.ts | 21 +
.../resources/webhooks/types/index.ts | 1 +
.../types/TestWebhookResponseData.ts | 20 +
src/serialization/types/index.ts | 1 +
tests/wire/billing.test.ts | 360 ++++++++++++++++
tests/wire/webhooks.test.ts | 139 ++++++
28 files changed, 1436 insertions(+), 6 deletions(-)
create mode 100644 src/api/resources/billing/types/DeleteBillingCouponResponse.ts
create mode 100644 src/api/resources/billing/types/DeleteBillingCustomerResponse.ts
create mode 100644 src/api/resources/billing/types/DeleteBillingInvoiceResponse.ts
create mode 100644 src/api/resources/webhooks/client/requests/TestWebhookRequestBody.ts
create mode 100644 src/api/resources/webhooks/types/SendTestWebhookActionResponse.ts
create mode 100644 src/api/types/TestWebhookResponseData.ts
create mode 100644 src/serialization/resources/billing/types/DeleteBillingCouponResponse.ts
create mode 100644 src/serialization/resources/billing/types/DeleteBillingCustomerResponse.ts
create mode 100644 src/serialization/resources/billing/types/DeleteBillingInvoiceResponse.ts
create mode 100644 src/serialization/resources/webhooks/client/requests/TestWebhookRequestBody.ts
create mode 100644 src/serialization/resources/webhooks/types/SendTestWebhookActionResponse.ts
create mode 100644 src/serialization/types/TestWebhookResponseData.ts
diff --git a/.fern/metadata.json b/.fern/metadata.json
index 8a1fbf84..aa3b830f 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -53,10 +53,10 @@
]
}
},
- "originGitCommit": "df83a2723a19055c70199e3b0b78b77e9c394838",
+ "originGitCommit": "26286134afce586aa5dbd02bffc9f25da6217032",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
- "requestedVersion": "1.5.1",
+ "requestedVersion": "1.5.2",
"ciProvider": "github",
- "sdkVersion": "1.5.1"
+ "sdkVersion": "1.5.2"
}
diff --git a/package.json b/package.json
index 01554668..c36b4b5e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@schematichq/schematic-typescript-node",
- "version": "1.5.1",
+ "version": "1.5.2",
"private": false,
"repository": {
"type": "git",
diff --git a/reference.md b/reference.md
index 9429444b..628733f8 100644
--- a/reference.md
+++ b/reference.md
@@ -1126,6 +1126,104 @@ await client.billing.upsertBillingCoupon({
+
+
+
+
+client.billing.deleteBillingCoupon(billing_id) -> Schematic.DeleteBillingCouponResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.billing.deleteBillingCoupon("billing_id");
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `string` — billing_id
+
+
+
+
+
+-
+
+**requestOptions:** `BillingClient.RequestOptions`
+
+
+
+
+
+
+
+
+
+
+
+client.billing.deleteBillingCustomer(billing_id) -> Schematic.DeleteBillingCustomerResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.billing.deleteBillingCustomer("billing_id");
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `string` — billing_id
+
+
+
+
+
+-
+
+**requestOptions:** `BillingClient.RequestOptions`
+
+
+
+
+
+
+
@@ -1406,6 +1504,55 @@ await client.billing.upsertInvoice({
+
+
+
+
+client.billing.deleteBillingInvoice(billing_id) -> Schematic.DeleteBillingInvoiceResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.billing.deleteBillingInvoice("billing_id");
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**billing_id:** `string` — billing_id
+
+
+
+
+
+-
+
+**requestOptions:** `BillingClient.RequestOptions`
+
+
+
+
+
+
+
@@ -12538,6 +12685,65 @@ await client.webhooks.deleteWebhook("webhook_id");
+
+
+
+
+client.webhooks.sendTestWebhookAction(webhook_id, { ...params }) -> Schematic.SendTestWebhookActionResponse
+
+-
+
+#### 🔌 Usage
+
+
+-
+
+
+-
+
+```typescript
+await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended"
+});
+
+```
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+-
+
+
+-
+
+**webhook_id:** `string` — webhook_id
+
+
+
+
+
+-
+
+**request:** `Schematic.TestWebhookRequestBody`
+
+
+
+
+
+-
+
+**requestOptions:** `WebhooksClient.RequestOptions`
+
+
+
+
+
+
+
diff --git a/src/BaseClient.ts b/src/BaseClient.ts
index 18495e95..6aefd0cb 100644
--- a/src/BaseClient.ts
+++ b/src/BaseClient.ts
@@ -60,8 +60,8 @@ export function normalizeClientOptions {
+ return core.HttpResponsePromise.fromPromise(this.__deleteBillingCoupon(billing_id, requestOptions));
+ }
+
+ private async __deleteBillingCoupon(
+ billing_id: string,
+ requestOptions?: BillingClient.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,
+ `billing/coupons/${core.url.encodePathParam(billing_id)}`,
+ ),
+ method: "DELETE",
+ headers: _headers,
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
+ 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.DeleteBillingCouponResponse.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,
+ "DELETE",
+ "/billing/coupons/{billing_id}",
+ );
+ }
+
+ /**
+ * @param {string} billing_id - billing_id
+ * @param {BillingClient.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.billing.deleteBillingCustomer("billing_id")
+ */
+ public deleteBillingCustomer(
+ billing_id: string,
+ requestOptions?: BillingClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__deleteBillingCustomer(billing_id, requestOptions));
+ }
+
+ private async __deleteBillingCustomer(
+ billing_id: string,
+ requestOptions?: BillingClient.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,
+ `billing/customer/${core.url.encodePathParam(billing_id)}`,
+ ),
+ method: "DELETE",
+ headers: _headers,
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
+ 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.DeleteBillingCustomerResponse.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,
+ "DELETE",
+ "/billing/customer/{billing_id}",
+ );
+ }
+
/**
* @param {Schematic.CreateBillingCustomerRequestBody} request
* @param {BillingClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -1034,6 +1300,139 @@ export class BillingClient {
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/billing/invoices");
}
+ /**
+ * @param {string} billing_id - billing_id
+ * @param {BillingClient.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.billing.deleteBillingInvoice("billing_id")
+ */
+ public deleteBillingInvoice(
+ billing_id: string,
+ requestOptions?: BillingClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__deleteBillingInvoice(billing_id, requestOptions));
+ }
+
+ private async __deleteBillingInvoice(
+ billing_id: string,
+ requestOptions?: BillingClient.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,
+ `billing/invoices/${core.url.encodePathParam(billing_id)}`,
+ ),
+ method: "DELETE",
+ headers: _headers,
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
+ 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.DeleteBillingInvoiceResponse.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,
+ "DELETE",
+ "/billing/invoices/{billing_id}",
+ );
+ }
+
/**
* @param {Schematic.ListMetersRequest} request
* @param {BillingClient.RequestOptions} requestOptions - Request-specific configuration.
diff --git a/src/api/resources/billing/types/DeleteBillingCouponResponse.ts b/src/api/resources/billing/types/DeleteBillingCouponResponse.ts
new file mode 100644
index 00000000..81c0fc6f
--- /dev/null
+++ b/src/api/resources/billing/types/DeleteBillingCouponResponse.ts
@@ -0,0 +1,9 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type * as Schematic from "../../../index";
+
+export interface DeleteBillingCouponResponse {
+ data: Schematic.DeleteResponse;
+ /** Input parameters */
+ params: Record;
+}
diff --git a/src/api/resources/billing/types/DeleteBillingCustomerResponse.ts b/src/api/resources/billing/types/DeleteBillingCustomerResponse.ts
new file mode 100644
index 00000000..0239b18b
--- /dev/null
+++ b/src/api/resources/billing/types/DeleteBillingCustomerResponse.ts
@@ -0,0 +1,9 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type * as Schematic from "../../../index";
+
+export interface DeleteBillingCustomerResponse {
+ data: Schematic.DeleteResponse;
+ /** Input parameters */
+ params: Record;
+}
diff --git a/src/api/resources/billing/types/DeleteBillingInvoiceResponse.ts b/src/api/resources/billing/types/DeleteBillingInvoiceResponse.ts
new file mode 100644
index 00000000..a3a942b2
--- /dev/null
+++ b/src/api/resources/billing/types/DeleteBillingInvoiceResponse.ts
@@ -0,0 +1,9 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type * as Schematic from "../../../index";
+
+export interface DeleteBillingInvoiceResponse {
+ data: Schematic.DeleteResponse;
+ /** Input parameters */
+ params: Record;
+}
diff --git a/src/api/resources/billing/types/index.ts b/src/api/resources/billing/types/index.ts
index 28592f5c..7e9332c9 100644
--- a/src/api/resources/billing/types/index.ts
+++ b/src/api/resources/billing/types/index.ts
@@ -2,6 +2,9 @@ export * from "./CountBillingProductsParams";
export * from "./CountBillingProductsResponse";
export * from "./CountCustomersParams";
export * from "./CountCustomersResponse";
+export * from "./DeleteBillingCouponResponse";
+export * from "./DeleteBillingCustomerResponse";
+export * from "./DeleteBillingInvoiceResponse";
export * from "./DeleteBillingProductResponse";
export * from "./DeletePaymentMethodByExternalIdResponse";
export * from "./DeleteProductPriceResponse";
diff --git a/src/api/resources/webhooks/client/Client.ts b/src/api/resources/webhooks/client/Client.ts
index 75868f60..b8749280 100644
--- a/src/api/resources/webhooks/client/Client.ts
+++ b/src/api/resources/webhooks/client/Client.ts
@@ -1091,6 +1091,142 @@ export class WebhooksClient {
return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/webhooks/{webhook_id}");
}
+ /**
+ * @param {string} webhook_id - webhook_id
+ * @param {Schematic.TestWebhookRequestBody} request
+ * @param {WebhooksClient.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.webhooks.sendTestWebhookAction("webhook_id", {
+ * requestType: "subscription.trial.ended"
+ * })
+ */
+ public sendTestWebhookAction(
+ webhook_id: string,
+ request: Schematic.TestWebhookRequestBody,
+ requestOptions?: WebhooksClient.RequestOptions,
+ ): core.HttpResponsePromise {
+ return core.HttpResponsePromise.fromPromise(this.__sendTestWebhookAction(webhook_id, request, requestOptions));
+ }
+
+ private async __sendTestWebhookAction(
+ webhook_id: string,
+ request: Schematic.TestWebhookRequestBody,
+ requestOptions?: WebhooksClient.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,
+ `webhooks/${core.url.encodePathParam(webhook_id)}/test`,
+ ),
+ method: "POST",
+ headers: _headers,
+ contentType: "application/json",
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
+ requestType: "json",
+ body: serializers.TestWebhookRequestBody.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.SendTestWebhookActionResponse.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", "/webhooks/{webhook_id}/test");
+ }
+
/**
* @param {Schematic.CountWebhooksRequest} request
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
diff --git a/src/api/resources/webhooks/client/requests/TestWebhookRequestBody.ts b/src/api/resources/webhooks/client/requests/TestWebhookRequestBody.ts
new file mode 100644
index 00000000..d004745b
--- /dev/null
+++ b/src/api/resources/webhooks/client/requests/TestWebhookRequestBody.ts
@@ -0,0 +1,13 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type * as Schematic from "../../../../index";
+
+/**
+ * @example
+ * {
+ * requestType: "subscription.trial.ended"
+ * }
+ */
+export interface TestWebhookRequestBody {
+ requestType: Schematic.WebhookRequestType;
+}
diff --git a/src/api/resources/webhooks/client/requests/index.ts b/src/api/resources/webhooks/client/requests/index.ts
index ef4b6f5c..37895b6e 100644
--- a/src/api/resources/webhooks/client/requests/index.ts
+++ b/src/api/resources/webhooks/client/requests/index.ts
@@ -3,4 +3,5 @@ export type { CountWebhooksRequest } from "./CountWebhooksRequest";
export type { CreateWebhookRequestBody } from "./CreateWebhookRequestBody";
export type { ListWebhookEventsRequest } from "./ListWebhookEventsRequest";
export type { ListWebhooksRequest } from "./ListWebhooksRequest";
+export type { TestWebhookRequestBody } from "./TestWebhookRequestBody";
export type { UpdateWebhookRequestBody } from "./UpdateWebhookRequestBody";
diff --git a/src/api/resources/webhooks/types/SendTestWebhookActionResponse.ts b/src/api/resources/webhooks/types/SendTestWebhookActionResponse.ts
new file mode 100644
index 00000000..59fd120c
--- /dev/null
+++ b/src/api/resources/webhooks/types/SendTestWebhookActionResponse.ts
@@ -0,0 +1,9 @@
+// This file was auto-generated by Fern from our API Definition.
+
+import type * as Schematic from "../../../index";
+
+export interface SendTestWebhookActionResponse {
+ data: Schematic.TestWebhookResponseData;
+ /** Input parameters */
+ params: Record;
+}
diff --git a/src/api/resources/webhooks/types/index.ts b/src/api/resources/webhooks/types/index.ts
index a08121b5..0b8ad4e4 100644
--- a/src/api/resources/webhooks/types/index.ts
+++ b/src/api/resources/webhooks/types/index.ts
@@ -10,4 +10,5 @@ export * from "./ListWebhookEventsParams";
export * from "./ListWebhookEventsResponse";
export * from "./ListWebhooksParams";
export * from "./ListWebhooksResponse";
+export * from "./SendTestWebhookActionResponse";
export * from "./UpdateWebhookResponse";
diff --git a/src/api/types/TestWebhookResponseData.ts b/src/api/types/TestWebhookResponseData.ts
new file mode 100644
index 00000000..6e08abbb
--- /dev/null
+++ b/src/api/types/TestWebhookResponseData.ts
@@ -0,0 +1,6 @@
+// This file was auto-generated by Fern from our API Definition.
+
+export interface TestWebhookResponseData {
+ responseCode: number;
+ success: boolean;
+}
diff --git a/src/api/types/index.ts b/src/api/types/index.ts
index e8b6d960..b3818b72 100644
--- a/src/api/types/index.ts
+++ b/src/api/types/index.ts
@@ -340,6 +340,7 @@ export * from "./SubscriptionTraitUpdate";
export * from "./SubscriptionType";
export * from "./TemporaryAccessTokenResourceType";
export * from "./TemporaryAccessTokenResponseData";
+export * from "./TestWebhookResponseData";
export * from "./TimeSeriesGranularity";
export * from "./TopFeatureByUsageResponseData";
export * from "./TopFeaturesByUsageResponseData";
diff --git a/src/serialization/resources/billing/types/DeleteBillingCouponResponse.ts b/src/serialization/resources/billing/types/DeleteBillingCouponResponse.ts
new file mode 100644
index 00000000..cb3116b2
--- /dev/null
+++ b/src/serialization/resources/billing/types/DeleteBillingCouponResponse.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 { DeleteResponse } from "../../../types/DeleteResponse";
+
+export const DeleteBillingCouponResponse: core.serialization.ObjectSchema<
+ serializers.DeleteBillingCouponResponse.Raw,
+ Schematic.DeleteBillingCouponResponse
+> = core.serialization.object({
+ data: DeleteResponse,
+ params: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
+});
+
+export declare namespace DeleteBillingCouponResponse {
+ export interface Raw {
+ data: DeleteResponse.Raw;
+ params: Record;
+ }
+}
diff --git a/src/serialization/resources/billing/types/DeleteBillingCustomerResponse.ts b/src/serialization/resources/billing/types/DeleteBillingCustomerResponse.ts
new file mode 100644
index 00000000..06804cfe
--- /dev/null
+++ b/src/serialization/resources/billing/types/DeleteBillingCustomerResponse.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 { DeleteResponse } from "../../../types/DeleteResponse";
+
+export const DeleteBillingCustomerResponse: core.serialization.ObjectSchema<
+ serializers.DeleteBillingCustomerResponse.Raw,
+ Schematic.DeleteBillingCustomerResponse
+> = core.serialization.object({
+ data: DeleteResponse,
+ params: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
+});
+
+export declare namespace DeleteBillingCustomerResponse {
+ export interface Raw {
+ data: DeleteResponse.Raw;
+ params: Record;
+ }
+}
diff --git a/src/serialization/resources/billing/types/DeleteBillingInvoiceResponse.ts b/src/serialization/resources/billing/types/DeleteBillingInvoiceResponse.ts
new file mode 100644
index 00000000..edc5fc72
--- /dev/null
+++ b/src/serialization/resources/billing/types/DeleteBillingInvoiceResponse.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 { DeleteResponse } from "../../../types/DeleteResponse";
+
+export const DeleteBillingInvoiceResponse: core.serialization.ObjectSchema<
+ serializers.DeleteBillingInvoiceResponse.Raw,
+ Schematic.DeleteBillingInvoiceResponse
+> = core.serialization.object({
+ data: DeleteResponse,
+ params: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
+});
+
+export declare namespace DeleteBillingInvoiceResponse {
+ export interface Raw {
+ data: DeleteResponse.Raw;
+ params: Record;
+ }
+}
diff --git a/src/serialization/resources/billing/types/index.ts b/src/serialization/resources/billing/types/index.ts
index 28592f5c..7e9332c9 100644
--- a/src/serialization/resources/billing/types/index.ts
+++ b/src/serialization/resources/billing/types/index.ts
@@ -2,6 +2,9 @@ export * from "./CountBillingProductsParams";
export * from "./CountBillingProductsResponse";
export * from "./CountCustomersParams";
export * from "./CountCustomersResponse";
+export * from "./DeleteBillingCouponResponse";
+export * from "./DeleteBillingCustomerResponse";
+export * from "./DeleteBillingInvoiceResponse";
export * from "./DeleteBillingProductResponse";
export * from "./DeletePaymentMethodByExternalIdResponse";
export * from "./DeleteProductPriceResponse";
diff --git a/src/serialization/resources/webhooks/client/requests/TestWebhookRequestBody.ts b/src/serialization/resources/webhooks/client/requests/TestWebhookRequestBody.ts
new file mode 100644
index 00000000..e404eb2d
--- /dev/null
+++ b/src/serialization/resources/webhooks/client/requests/TestWebhookRequestBody.ts
@@ -0,0 +1,19 @@
+// 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 { WebhookRequestType } from "../../../../types/WebhookRequestType";
+
+export const TestWebhookRequestBody: core.serialization.Schema<
+ serializers.TestWebhookRequestBody.Raw,
+ Schematic.TestWebhookRequestBody
+> = core.serialization.object({
+ requestType: core.serialization.property("request_type", WebhookRequestType),
+});
+
+export declare namespace TestWebhookRequestBody {
+ export interface Raw {
+ request_type: WebhookRequestType.Raw;
+ }
+}
diff --git a/src/serialization/resources/webhooks/client/requests/index.ts b/src/serialization/resources/webhooks/client/requests/index.ts
index 15072237..ba7bb71d 100644
--- a/src/serialization/resources/webhooks/client/requests/index.ts
+++ b/src/serialization/resources/webhooks/client/requests/index.ts
@@ -1,2 +1,3 @@
export { CreateWebhookRequestBody } from "./CreateWebhookRequestBody";
+export { TestWebhookRequestBody } from "./TestWebhookRequestBody";
export { UpdateWebhookRequestBody } from "./UpdateWebhookRequestBody";
diff --git a/src/serialization/resources/webhooks/types/SendTestWebhookActionResponse.ts b/src/serialization/resources/webhooks/types/SendTestWebhookActionResponse.ts
new file mode 100644
index 00000000..692855f0
--- /dev/null
+++ b/src/serialization/resources/webhooks/types/SendTestWebhookActionResponse.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 { TestWebhookResponseData } from "../../../types/TestWebhookResponseData";
+
+export const SendTestWebhookActionResponse: core.serialization.ObjectSchema<
+ serializers.SendTestWebhookActionResponse.Raw,
+ Schematic.SendTestWebhookActionResponse
+> = core.serialization.object({
+ data: TestWebhookResponseData,
+ params: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
+});
+
+export declare namespace SendTestWebhookActionResponse {
+ export interface Raw {
+ data: TestWebhookResponseData.Raw;
+ params: Record;
+ }
+}
diff --git a/src/serialization/resources/webhooks/types/index.ts b/src/serialization/resources/webhooks/types/index.ts
index a08121b5..0b8ad4e4 100644
--- a/src/serialization/resources/webhooks/types/index.ts
+++ b/src/serialization/resources/webhooks/types/index.ts
@@ -10,4 +10,5 @@ export * from "./ListWebhookEventsParams";
export * from "./ListWebhookEventsResponse";
export * from "./ListWebhooksParams";
export * from "./ListWebhooksResponse";
+export * from "./SendTestWebhookActionResponse";
export * from "./UpdateWebhookResponse";
diff --git a/src/serialization/types/TestWebhookResponseData.ts b/src/serialization/types/TestWebhookResponseData.ts
new file mode 100644
index 00000000..0696daa1
--- /dev/null
+++ b/src/serialization/types/TestWebhookResponseData.ts
@@ -0,0 +1,20 @@
+// 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 TestWebhookResponseData: core.serialization.ObjectSchema<
+ serializers.TestWebhookResponseData.Raw,
+ Schematic.TestWebhookResponseData
+> = core.serialization.object({
+ responseCode: core.serialization.property("response_code", core.serialization.number()),
+ success: core.serialization.boolean(),
+});
+
+export declare namespace TestWebhookResponseData {
+ export interface Raw {
+ response_code: number;
+ success: boolean;
+ }
+}
diff --git a/src/serialization/types/index.ts b/src/serialization/types/index.ts
index e8b6d960..b3818b72 100644
--- a/src/serialization/types/index.ts
+++ b/src/serialization/types/index.ts
@@ -340,6 +340,7 @@ export * from "./SubscriptionTraitUpdate";
export * from "./SubscriptionType";
export * from "./TemporaryAccessTokenResourceType";
export * from "./TemporaryAccessTokenResponseData";
+export * from "./TestWebhookResponseData";
export * from "./TimeSeriesGranularity";
export * from "./TopFeatureByUsageResponseData";
export * from "./TopFeaturesByUsageResponseData";
diff --git a/tests/wire/billing.test.ts b/tests/wire/billing.test.ts
index 88cfb036..d9d5c6d6 100644
--- a/tests/wire/billing.test.ts
+++ b/tests/wire/billing.test.ts
@@ -413,6 +413,246 @@ describe("BillingClient", () => {
}).rejects.toThrow(Schematic.InternalServerError);
});
+ test("deleteBillingCoupon (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { data: { deleted: true }, params: { key: "value" } };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.billing.deleteBillingCoupon("billing_id");
+ expect(response).toEqual({
+ data: {
+ deleted: true,
+ },
+ params: {
+ key: "value",
+ },
+ });
+ });
+
+ test("deleteBillingCoupon (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCoupon("billing_id");
+ }).rejects.toThrow(Schematic.BadRequestError);
+ });
+
+ test("deleteBillingCoupon (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCoupon("billing_id");
+ }).rejects.toThrow(Schematic.UnauthorizedError);
+ });
+
+ test("deleteBillingCoupon (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCoupon("billing_id");
+ }).rejects.toThrow(Schematic.ForbiddenError);
+ });
+
+ test("deleteBillingCoupon (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(404)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCoupon("billing_id");
+ }).rejects.toThrow(Schematic.NotFoundError);
+ });
+
+ test("deleteBillingCoupon (6)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/coupons/billing_id")
+ .respondWith()
+ .statusCode(500)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCoupon("billing_id");
+ }).rejects.toThrow(Schematic.InternalServerError);
+ });
+
+ test("deleteBillingCustomer (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { data: { deleted: true }, params: { key: "value" } };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.billing.deleteBillingCustomer("billing_id");
+ expect(response).toEqual({
+ data: {
+ deleted: true,
+ },
+ params: {
+ key: "value",
+ },
+ });
+ });
+
+ test("deleteBillingCustomer (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCustomer("billing_id");
+ }).rejects.toThrow(Schematic.BadRequestError);
+ });
+
+ test("deleteBillingCustomer (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCustomer("billing_id");
+ }).rejects.toThrow(Schematic.UnauthorizedError);
+ });
+
+ test("deleteBillingCustomer (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCustomer("billing_id");
+ }).rejects.toThrow(Schematic.ForbiddenError);
+ });
+
+ test("deleteBillingCustomer (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(404)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCustomer("billing_id");
+ }).rejects.toThrow(Schematic.NotFoundError);
+ });
+
+ test("deleteBillingCustomer (6)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/customer/billing_id")
+ .respondWith()
+ .statusCode(500)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingCustomer("billing_id");
+ }).rejects.toThrow(Schematic.InternalServerError);
+ });
+
test("upsertBillingCustomer (1)", async () => {
const server = mockServerPool.createServer();
const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
@@ -1309,6 +1549,126 @@ describe("BillingClient", () => {
}).rejects.toThrow(Schematic.InternalServerError);
});
+ test("deleteBillingInvoice (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { data: { deleted: true }, params: { key: "value" } };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.billing.deleteBillingInvoice("billing_id");
+ expect(response).toEqual({
+ data: {
+ deleted: true,
+ },
+ params: {
+ key: "value",
+ },
+ });
+ });
+
+ test("deleteBillingInvoice (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingInvoice("billing_id");
+ }).rejects.toThrow(Schematic.BadRequestError);
+ });
+
+ test("deleteBillingInvoice (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingInvoice("billing_id");
+ }).rejects.toThrow(Schematic.UnauthorizedError);
+ });
+
+ test("deleteBillingInvoice (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingInvoice("billing_id");
+ }).rejects.toThrow(Schematic.ForbiddenError);
+ });
+
+ test("deleteBillingInvoice (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(404)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingInvoice("billing_id");
+ }).rejects.toThrow(Schematic.NotFoundError);
+ });
+
+ test("deleteBillingInvoice (6)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .delete("/billing/invoices/billing_id")
+ .respondWith()
+ .statusCode(500)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.billing.deleteBillingInvoice("billing_id");
+ }).rejects.toThrow(Schematic.InternalServerError);
+ });
+
test("listMeters (1)", async () => {
const server = mockServerPool.createServer();
const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
diff --git a/tests/wire/webhooks.test.ts b/tests/wire/webhooks.test.ts
index 0fd71f87..f6702452 100644
--- a/tests/wire/webhooks.test.ts
+++ b/tests/wire/webhooks.test.ts
@@ -1166,6 +1166,145 @@ describe("WebhooksClient", () => {
}).rejects.toThrow(Schematic.InternalServerError);
});
+ test("sendTestWebhookAction (1)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { data: { response_code: 1000000, success: true }, params: { key: "value" } };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(200)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ const response = await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ expect(response).toEqual({
+ data: {
+ responseCode: 1000000,
+ success: true,
+ },
+ params: {
+ key: "value",
+ },
+ });
+ });
+
+ test("sendTestWebhookAction (2)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(400)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ }).rejects.toThrow(Schematic.BadRequestError);
+ });
+
+ test("sendTestWebhookAction (3)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(401)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ }).rejects.toThrow(Schematic.UnauthorizedError);
+ });
+
+ test("sendTestWebhookAction (4)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(403)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ }).rejects.toThrow(Schematic.ForbiddenError);
+ });
+
+ test("sendTestWebhookAction (5)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(404)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ }).rejects.toThrow(Schematic.NotFoundError);
+ });
+
+ test("sendTestWebhookAction (6)", async () => {
+ const server = mockServerPool.createServer();
+ const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });
+ const rawRequestBody = { request_type: "subscription.trial.ended" };
+ const rawResponseBody = { error: "error" };
+
+ server
+ .mockEndpoint()
+ .post("/webhooks/webhook_id/test")
+ .jsonBody(rawRequestBody)
+ .respondWith()
+ .statusCode(500)
+ .jsonBody(rawResponseBody)
+ .build();
+
+ await expect(async () => {
+ return await client.webhooks.sendTestWebhookAction("webhook_id", {
+ requestType: "subscription.trial.ended",
+ });
+ }).rejects.toThrow(Schematic.InternalServerError);
+ });
+
test("countWebhooks (1)", async () => {
const server = mockServerPool.createServer();
const client = new SchematicClient({ maxRetries: 0, apiKey: "test", environment: server.baseUrl });