Skip to content

Commit

Permalink
SDK regeneration (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
  • Loading branch information
fern-api[bot] authored Nov 21, 2024
1 parent c867448 commit 251eae7
Show file tree
Hide file tree
Showing 62 changed files with 3,097 additions and 11 deletions.
2,540 changes: 2,540 additions & 0 deletions reference.md

Large diffs are not rendered by default.

184 changes: 181 additions & 3 deletions src/api/resources/billing/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,145 @@ export class Billing {
}
}

/**
* @param {Schematic.SearchBillingPricesRequest} request
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Schematic.BadRequestError}
* @throws {@link Schematic.UnauthorizedError}
* @throws {@link Schematic.ForbiddenError}
* @throws {@link Schematic.InternalServerError}
*
* @example
* await client.billing.searchBillingPrices()
*/
public async searchBillingPrices(
request: Schematic.SearchBillingPricesRequest = {},
requestOptions?: Billing.RequestOptions
): Promise<Schematic.SearchBillingPricesResponse> {
const { ids, usageType, price, limit, offset } = request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (ids != null) {
if (Array.isArray(ids)) {
_queryParams["ids"] = ids.map((item) => item);
} else {
_queryParams["ids"] = ids;
}
}

if (usageType != null) {
_queryParams["usage_type"] = usageType;
}

if (price != null) {
_queryParams["price"] = price.toString();
}

if (limit != null) {
_queryParams["limit"] = limit.toString();
}

if (offset != null) {
_queryParams["offset"] = offset.toString();
}

const _response = await (this._options.fetcher ?? core.fetcher)({
url: urlJoin(
(await core.Supplier.get(this._options.environment)) ?? environments.SchematicEnvironment.Default,
"billing/price"
),
method: "GET",
headers: {
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@schematichq/schematic-typescript-node",
"X-Fern-SDK-Version": "1.1.6",
"User-Agent": "@schematichq/schematic-typescript-node/1.1.6",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
...(await this._getCustomAuthorizationHeaders()),
},
contentType: "application/json",
queryParameters: _queryParams,
requestType: "json",
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
maxRetries: requestOptions?.maxRetries,
abortSignal: requestOptions?.abortSignal,
});
if (_response.ok) {
return serializers.SearchBillingPricesResponse.parseOrThrow(_response.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
});
}

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"],
})
);
case 401:
throw new Schematic.UnauthorizedError(
serializers.ApiError.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
case 403:
throw new Schematic.ForbiddenError(
serializers.ApiError.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
case 500:
throw new Schematic.InternalServerError(
serializers.ApiError.parseOrThrow(_response.error.body, {
unrecognizedObjectKeys: "passthrough",
allowUnrecognizedUnionMembers: true,
allowUnrecognizedEnumValues: true,
skipValidation: true,
breadcrumbsPrefix: ["response"],
})
);
default:
throw new errors.SchematicError({
statusCode: _response.error.statusCode,
body: _response.error.body,
});
}
}

switch (_response.error.reason) {
case "non-json":
throw new errors.SchematicError({
statusCode: _response.error.statusCode,
body: _response.error.rawBody,
});
case "timeout":
throw new errors.SchematicTimeoutError();
case "unknown":
throw new errors.SchematicError({
message: _response.error.errorMessage,
});
}
}

/**
* @param {Schematic.CreateBillingPriceRequestBody} request
* @param {Billing.RequestOptions} requestOptions - Request-specific configuration.
Expand Down Expand Up @@ -1309,7 +1448,8 @@ export class Billing {
request: Schematic.ListProductPricesRequest = {},
requestOptions?: Billing.RequestOptions
): Promise<Schematic.ListProductPricesResponse> {
const { ids, name, q, withoutLinkedToPlan, limit, offset } = request;
const { ids, name, q, priceUsageType, withoutLinkedToPlan, withZeroPrice, withPricesOnly, limit, offset } =
request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (ids != null) {
if (Array.isArray(ids)) {
Expand All @@ -1327,10 +1467,22 @@ export class Billing {
_queryParams["q"] = q;
}

if (priceUsageType != null) {
_queryParams["price_usage_type"] = priceUsageType;
}

if (withoutLinkedToPlan != null) {
_queryParams["without_linked_to_plan"] = withoutLinkedToPlan.toString();
}

if (withZeroPrice != null) {
_queryParams["with_zero_price"] = withZeroPrice.toString();
}

if (withPricesOnly != null) {
_queryParams["with_prices_only"] = withPricesOnly.toString();
}

if (limit != null) {
_queryParams["limit"] = limit.toString();
}
Expand Down Expand Up @@ -1683,7 +1835,8 @@ export class Billing {
request: Schematic.ListBillingProductsRequest = {},
requestOptions?: Billing.RequestOptions
): Promise<Schematic.ListBillingProductsResponse> {
const { ids, name, q, withoutLinkedToPlan, limit, offset } = request;
const { ids, name, q, priceUsageType, withoutLinkedToPlan, withZeroPrice, withPricesOnly, limit, offset } =
request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (ids != null) {
if (Array.isArray(ids)) {
Expand All @@ -1701,10 +1854,22 @@ export class Billing {
_queryParams["q"] = q;
}

if (priceUsageType != null) {
_queryParams["price_usage_type"] = priceUsageType;
}

if (withoutLinkedToPlan != null) {
_queryParams["without_linked_to_plan"] = withoutLinkedToPlan.toString();
}

if (withZeroPrice != null) {
_queryParams["with_zero_price"] = withZeroPrice.toString();
}

if (withPricesOnly != null) {
_queryParams["with_prices_only"] = withPricesOnly.toString();
}

if (limit != null) {
_queryParams["limit"] = limit.toString();
}
Expand Down Expand Up @@ -1826,7 +1991,8 @@ export class Billing {
request: Schematic.CountBillingProductsRequest = {},
requestOptions?: Billing.RequestOptions
): Promise<Schematic.CountBillingProductsResponse> {
const { ids, name, q, withoutLinkedToPlan, limit, offset } = request;
const { ids, name, q, priceUsageType, withoutLinkedToPlan, withZeroPrice, withPricesOnly, limit, offset } =
request;
const _queryParams: Record<string, string | string[] | object | object[]> = {};
if (ids != null) {
if (Array.isArray(ids)) {
Expand All @@ -1844,10 +2010,22 @@ export class Billing {
_queryParams["q"] = q;
}

if (priceUsageType != null) {
_queryParams["price_usage_type"] = priceUsageType;
}

if (withoutLinkedToPlan != null) {
_queryParams["without_linked_to_plan"] = withoutLinkedToPlan.toString();
}

if (withZeroPrice != null) {
_queryParams["with_zero_price"] = withZeroPrice.toString();
}

if (withPricesOnly != null) {
_queryParams["with_prices_only"] = withPricesOnly.toString();
}

if (limit != null) {
_queryParams["limit"] = limit.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ export interface CountBillingProductsRequest {
ids?: string | string[];
name?: string;
q?: string;
priceUsageType?: string;
/**
* Filter products that are not linked to any plan
*/
withoutLinkedToPlan?: boolean;
/**
* Filter products that have zero price for free subscription type
*/
withZeroPrice?: boolean;
/**
* Filter products that have prices
*/
withPricesOnly?: boolean;
/**
* Page limit (default 100)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ export interface CreateBillingSubscriptionsRequestBody {
status?: string;
subscriptionExternalId: string;
totalPrice: number;
trialEnd?: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ export interface ListBillingProductsRequest {
ids?: string | string[];
name?: string;
q?: string;
priceUsageType?: string;
/**
* Filter products that are not linked to any plan
*/
withoutLinkedToPlan?: boolean;
/**
* Filter products that have zero price for free subscription type
*/
withZeroPrice?: boolean;
/**
* Filter products that have prices
*/
withPricesOnly?: boolean;
/**
* Page limit (default 100)
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,19 @@ export interface ListProductPricesRequest {
ids?: string | string[];
name?: string;
q?: string;
priceUsageType?: string;
/**
* Filter products that are not linked to any plan
*/
withoutLinkedToPlan?: boolean;
/**
* Filter products that have zero price for free subscription type
*/
withZeroPrice?: boolean;
/**
* Filter products that have prices
*/
withPricesOnly?: boolean;
/**
* Page limit (default 100)
*/
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.
*/

/**
* @example
* {}
*/
export interface SearchBillingPricesRequest {
ids?: string | string[];
usageType?: string;
price?: number;
/**
* Page limit (default 100)
*/
limit?: number;
/**
* Page offset (default 0)
*/
offset?: number;
}
1 change: 1 addition & 0 deletions src/api/resources/billing/client/requests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { type ListMetersRequest } from "./ListMetersRequest";
export { type CreateMeterRequestBody } from "./CreateMeterRequestBody";
export { type ListPaymentMethodsRequest } from "./ListPaymentMethodsRequest";
export { type CreatePaymentMethodRequestBody } from "./CreatePaymentMethodRequestBody";
export { type SearchBillingPricesRequest } from "./SearchBillingPricesRequest";
export { type CreateBillingPriceRequestBody } from "./CreateBillingPriceRequestBody";
export { type ListProductPricesRequest } from "./ListProductPricesRequest";
export { type CreateBillingProductRequestBody } from "./CreateBillingProductRequestBody";
Expand Down
5 changes: 5 additions & 0 deletions src/api/resources/billing/types/CountBillingProductsParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export interface CountBillingProductsParams {
name?: string;
/** Page offset (default 0) */
offset?: number;
priceUsageType?: string;
q?: string;
/** Filter products that have prices */
withPricesOnly?: boolean;
/** Filter products that have zero price for free subscription type */
withZeroPrice?: boolean;
/** Filter products that are not linked to any plan */
withoutLinkedToPlan?: boolean;
}
5 changes: 5 additions & 0 deletions src/api/resources/billing/types/ListBillingProductsParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export interface ListBillingProductsParams {
name?: string;
/** Page offset (default 0) */
offset?: number;
priceUsageType?: string;
q?: string;
/** Filter products that have prices */
withPricesOnly?: boolean;
/** Filter products that have zero price for free subscription type */
withZeroPrice?: boolean;
/** Filter products that are not linked to any plan */
withoutLinkedToPlan?: boolean;
}
5 changes: 5 additions & 0 deletions src/api/resources/billing/types/ListProductPricesParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ export interface ListProductPricesParams {
name?: string;
/** Page offset (default 0) */
offset?: number;
priceUsageType?: string;
q?: string;
/** Filter products that have prices */
withPricesOnly?: boolean;
/** Filter products that have zero price for free subscription type */
withZeroPrice?: boolean;
/** Filter products that are not linked to any plan */
withoutLinkedToPlan?: boolean;
}
16 changes: 16 additions & 0 deletions src/api/resources/billing/types/SearchBillingPricesParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* This file was auto-generated by Fern from our API Definition.
*/

/**
* Input parameters
*/
export interface SearchBillingPricesParams {
ids?: string[];
/** Page limit (default 100) */
limit?: number;
/** Page offset (default 0) */
offset?: number;
price?: number;
usageType?: string;
}
Loading

0 comments on commit 251eae7

Please sign in to comment.