Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .fern/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
]
}
},
"originGitCommit": "da06e51f2eb74b44ef38813ee3b4a2798c4becaf",
"originGitCommit": "470e0f433ab9bb0e88784674fa2e1efce62ebd9b",
"originGitCommitIsDirty": false,
"invokedBy": "ci",
"requestedVersion": "1.4.6",
Expand Down
49 changes: 49 additions & 0 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,55 @@ await client.billing.upsertPaymentMethod({
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.billing.<a href="/src/api/resources/billing/client/Client.ts">deletePaymentMethodByExternalId</a>(billing_id) -> Schematic.DeletePaymentMethodByExternalIdResponse</code></summary>
<dl>
<dd>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```typescript
await client.billing.deletePaymentMethodByExternalId("billing_id");

```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**billing_id:** `string` — billing_id

</dd>
</dl>

<dl>
<dd>

**requestOptions:** `BillingClient.RequestOptions`

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down
133 changes: 133 additions & 0 deletions src/api/resources/billing/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,139 @@ export class BillingClient {
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/billing/payment-methods");
}

/**
* @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.deletePaymentMethodByExternalId("billing_id")
*/
public deletePaymentMethodByExternalId(
billing_id: string,
requestOptions?: BillingClient.RequestOptions,
): core.HttpResponsePromise<Schematic.DeletePaymentMethodByExternalIdResponse> {
return core.HttpResponsePromise.fromPromise(this.__deletePaymentMethodByExternalId(billing_id, requestOptions));
}

private async __deletePaymentMethodByExternalId(
billing_id: string,
requestOptions?: BillingClient.RequestOptions,
): Promise<core.WithRawResponse<Schematic.DeletePaymentMethodByExternalIdResponse>> {
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/payment-methods/${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.DeletePaymentMethodByExternalIdResponse.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/payment-methods/{billing_id}",
);
}

/**
* @param {Schematic.ListBillingPricesRequest} request
* @param {BillingClient.RequestOptions} requestOptions - Request-specific configuration.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file was auto-generated by Fern from our API Definition.

import type * as Schematic from "../../../index";

export interface DeletePaymentMethodByExternalIdResponse {
data: Schematic.DeleteResponse;
/** Input parameters */
params: Record<string, unknown>;
}
1 change: 1 addition & 0 deletions src/api/resources/billing/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./CountBillingProductsResponse";
export * from "./CountCustomersParams";
export * from "./CountCustomersResponse";
export * from "./DeleteBillingProductResponse";
export * from "./DeletePaymentMethodByExternalIdResponse";
export * from "./DeleteProductPriceResponse";
export * from "./ListBillingPricesParams";
export * from "./ListBillingPricesResponse";
Expand Down
2 changes: 2 additions & 0 deletions src/api/types/EventBodyTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ export interface EventBodyTrack {
company?: Record<string, string>;
/** The name of the type of track event */
event: string;
/** Credit lease ID this track event is redeeming against */
leaseId?: string;
/** Optionally specify the quantity of the event */
quantity?: number;
/** A map of trait names to trait values */
Expand Down
Original file line number Diff line number Diff line change
@@ -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 DeletePaymentMethodByExternalIdResponse: core.serialization.ObjectSchema<
serializers.DeletePaymentMethodByExternalIdResponse.Raw,
Schematic.DeletePaymentMethodByExternalIdResponse
> = core.serialization.object({
data: DeleteResponse,
params: core.serialization.record(core.serialization.string(), core.serialization.unknown()),
});

export declare namespace DeletePaymentMethodByExternalIdResponse {
export interface Raw {
data: DeleteResponse.Raw;
params: Record<string, unknown>;
}
}
1 change: 1 addition & 0 deletions src/serialization/resources/billing/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from "./CountBillingProductsResponse";
export * from "./CountCustomersParams";
export * from "./CountCustomersResponse";
export * from "./DeleteBillingProductResponse";
export * from "./DeletePaymentMethodByExternalIdResponse";
export * from "./DeleteProductPriceResponse";
export * from "./ListBillingPricesParams";
export * from "./ListBillingPricesResponse";
Expand Down
2 changes: 2 additions & 0 deletions src/serialization/types/EventBodyTrack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const EventBodyTrack: core.serialization.ObjectSchema<serializers.EventBo
core.serialization.object({
company: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(),
event: core.serialization.string(),
leaseId: core.serialization.property("lease_id", core.serialization.string().optional()),
quantity: core.serialization.number().optional(),
traits: core.serialization.record(core.serialization.string(), core.serialization.unknown()).optional(),
user: core.serialization.record(core.serialization.string(), core.serialization.string()).optional(),
Expand All @@ -17,6 +18,7 @@ export declare namespace EventBodyTrack {
export interface Raw {
company?: Record<string, string> | null;
event: string;
lease_id?: string | null;
quantity?: number | null;
traits?: Record<string, unknown> | null;
user?: Record<string, string> | null;
Expand Down
Loading