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 .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.54.0"
".": "4.55.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 103
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-0dbb8ba730f755468357ebda41332664e8396faf29a6a6a64ad37cf35cf70d0c.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-43a4d1d907fd25faa99fef58ba7afb3dd39fae36f955b29bfe27b4bfdaa0ee54.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 4.55.0 (2025-02-07)

Full Changelog: [v4.54.0...v4.55.0](https://github.com/orbcorp/orb-node/compare/v4.54.0...v4.55.0)

### Features

* **api:** api update ([#501](https://github.com/orbcorp/orb-node/issues/501)) ([c47b1f8](https://github.com/orbcorp/orb-node/commit/c47b1f827e39e97eb98ac0970d49d501f31ef969))
* **client:** send `X-Stainless-Timeout` header ([#499](https://github.com/orbcorp/orb-node/issues/499)) ([bdbbbcb](https://github.com/orbcorp/orb-node/commit/bdbbbcb430640cccc4d648e672e72e2506f64373))

## 4.54.0 (2025-02-04)

Full Changelog: [v4.53.0...v4.54.0](https://github.com/orbcorp/orb-node/compare/v4.53.0...v4.54.0)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "orb-billing",
"version": "4.54.0",
"version": "4.55.0",
"description": "The official TypeScript library for the Orb API",
"author": "Orb <[email protected]>",
"types": "dist/index.d.ts",
Expand Down
20 changes: 14 additions & 6 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export abstract class APIClient {
options: FinalRequestOptions<Req>,
{ retryCount = 0 }: { retryCount?: number } = {},
): { req: RequestInit; url: string; timeout: number } {
options = { ...options };
const { method, path, query, headers: headers = {} } = options;

const body =
Expand All @@ -292,9 +293,9 @@ export abstract class APIClient {

const url = this.buildURL(path!, query);
if ('timeout' in options) validatePositiveInteger('timeout', options.timeout);
const timeout = options.timeout ?? this.timeout;
options.timeout = options.timeout ?? this.timeout;
const httpAgent = options.httpAgent ?? this.httpAgent ?? getDefaultAgent(url);
const minAgentTimeout = timeout + 1000;
const minAgentTimeout = options.timeout + 1000;
if (
typeof (httpAgent as any)?.options?.timeout === 'number' &&
minAgentTimeout > ((httpAgent as any).options.timeout ?? 0)
Expand Down Expand Up @@ -323,7 +324,7 @@ export abstract class APIClient {
signal: options.signal ?? null,
};

return { req, url, timeout };
return { req, url, timeout: options.timeout };
}

private buildHeaders({
Expand Down Expand Up @@ -351,15 +352,22 @@ export abstract class APIClient {
delete reqHeaders['content-type'];
}

// Don't set the retry count header if it was already set or removed through default headers or by the
// caller. We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to
// account for the removal case.
// Don't set theses headers if they were already set or removed through default headers or by the caller.
// We check `defaultHeaders` and `headers`, which can contain nulls, instead of `reqHeaders` to account
// for the removal case.
if (
getHeader(defaultHeaders, 'x-stainless-retry-count') === undefined &&
getHeader(headers, 'x-stainless-retry-count') === undefined
) {
reqHeaders['x-stainless-retry-count'] = String(retryCount);
}
if (
getHeader(defaultHeaders, 'x-stainless-timeout') === undefined &&
getHeader(headers, 'x-stainless-timeout') === undefined &&
options.timeout
) {
reqHeaders['x-stainless-timeout'] = String(options.timeout);
}

this.validateHeaders(reqHeaders, headers);

Expand Down
35 changes: 35 additions & 0 deletions src/resources/events/backfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ export interface BackfillCreateResponse {
*/
events_ingested: number;

/**
* If `true`, existing events in the backfill's timeframe will be replaced with the
* newly ingested events associated with the backfill. If `false`, newly ingested
* events will be added to the existing events.
*/
replace_existing_events: boolean;

/**
* The time at which this backfill was reverted.
*/
Expand Down Expand Up @@ -180,6 +187,13 @@ export interface BackfillListResponse {
*/
events_ingested: number;

/**
* If `true`, existing events in the backfill's timeframe will be replaced with the
* newly ingested events associated with the backfill. If `false`, newly ingested
* events will be added to the existing events.
*/
replace_existing_events: boolean;

/**
* The time at which this backfill was reverted.
*/
Expand Down Expand Up @@ -228,6 +242,13 @@ export interface BackfillCloseResponse {
*/
events_ingested: number;

/**
* If `true`, existing events in the backfill's timeframe will be replaced with the
* newly ingested events associated with the backfill. If `false`, newly ingested
* events will be added to the existing events.
*/
replace_existing_events: boolean;

/**
* The time at which this backfill was reverted.
*/
Expand Down Expand Up @@ -276,6 +297,13 @@ export interface BackfillFetchResponse {
*/
events_ingested: number;

/**
* If `true`, existing events in the backfill's timeframe will be replaced with the
* newly ingested events associated with the backfill. If `false`, newly ingested
* events will be added to the existing events.
*/
replace_existing_events: boolean;

/**
* The time at which this backfill was reverted.
*/
Expand Down Expand Up @@ -324,6 +352,13 @@ export interface BackfillRevertResponse {
*/
events_ingested: number;

/**
* If `true`, existing events in the backfill's timeframe will be replaced with the
* newly ingested events associated with the backfill. If `false`, newly ingested
* events will be added to the existing events.
*/
replace_existing_events: boolean;

/**
* The time at which this backfill was reverted.
*/
Expand Down
110 changes: 57 additions & 53 deletions src/resources/invoice-line-items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,30 @@ export interface InvoiceLineItemCreateResponse {
id: string;

/**
* The line amount after any adjustments, before overage conversion, credits and
* The line amount after any adjustments and before overage conversion, credits and
* partial invoicing.
*/
adjusted_subtotal: string;

/**
* All adjustments applied to the line item.
* All adjustments (ie. maximums, minimums, discounts) applied to the line item.
*/
adjustments: Array<
| InvoiceLineItemCreateResponse.AmountDiscountAdjustment
| InvoiceLineItemCreateResponse.PercentageDiscountAdjustment
| InvoiceLineItemCreateResponse.UsageDiscountAdjustment
| InvoiceLineItemCreateResponse.MinimumAdjustment
| InvoiceLineItemCreateResponse.MaximumAdjustment
| InvoiceLineItemCreateResponse.MonetaryUsageDiscountAdjustment
| InvoiceLineItemCreateResponse.MonetaryAmountDiscountAdjustment
| InvoiceLineItemCreateResponse.MonetaryPercentageDiscountAdjustment
| InvoiceLineItemCreateResponse.MonetaryMinimumAdjustment
| InvoiceLineItemCreateResponse.MonetaryMaximumAdjustment
>;

/**
* The final amount after any discounts or minimums.
* The final amount for a line item after all adjustments and pre paid credits have
* been applied.
*/
amount: string;

/**
* The number of credits used
* The number of prepaid credits applied.
*/
credits_applied: string;

Expand Down Expand Up @@ -109,6 +110,9 @@ export interface InvoiceLineItemCreateResponse {
*/
price: PricesAPI.Price | null;

/**
* Either the fixed fee quantity or the usage during the service period.
*/
quantity: number;

/**
Expand All @@ -127,7 +131,7 @@ export interface InvoiceLineItemCreateResponse {
>;

/**
* The line amount before any line item-specific discounts or minimums.
* The line amount before before any adjustments.
*/
subtotal: string;

Expand All @@ -139,16 +143,15 @@ export interface InvoiceLineItemCreateResponse {
}

export namespace InvoiceLineItemCreateResponse {
export interface AmountDiscountAdjustment {
export interface MonetaryUsageDiscountAdjustment {
id: string;

adjustment_type: 'amount_discount';
adjustment_type: 'usage_discount';

/**
* The amount by which to discount the prices this adjustment applies to in a given
* billing period.
* The value applied by an adjustment.
*/
amount_discount: string;
amount: string;

/**
* The price IDs that this adjustment applies to.
Expand All @@ -162,53 +165,59 @@ export namespace InvoiceLineItemCreateResponse {
is_invoice_level: boolean;

/**
* The plan phase in which this adjustment is active.
* The reason for the adjustment.
*/
plan_phase_order: number | null;
reason: string | null;

/**
* The reason for the adjustment.
* The number of usage units by which to discount the price this adjustment applies
* to in a given billing period.
*/
reason: string | null;
usage_discount: number;
}

export interface PercentageDiscountAdjustment {
export interface MonetaryAmountDiscountAdjustment {
id: string;

adjustment_type: 'percentage_discount';
adjustment_type: 'amount_discount';

/**
* The price IDs that this adjustment applies to.
* The value applied by an adjustment.
*/
applies_to_price_ids: Array<string>;
amount: string;

/**
* True for adjustments that apply to an entire invocice, false for adjustments
* that apply to only one price.
* The amount by which to discount the prices this adjustment applies to in a given
* billing period.
*/
is_invoice_level: boolean;
amount_discount: string;

/**
* The percentage (as a value between 0 and 1) by which to discount the price
* intervals this adjustment applies to in a given billing period.
* The price IDs that this adjustment applies to.
*/
percentage_discount: number;
applies_to_price_ids: Array<string>;

/**
* The plan phase in which this adjustment is active.
* True for adjustments that apply to an entire invocice, false for adjustments
* that apply to only one price.
*/
plan_phase_order: number | null;
is_invoice_level: boolean;

/**
* The reason for the adjustment.
*/
reason: string | null;
}

export interface UsageDiscountAdjustment {
export interface MonetaryPercentageDiscountAdjustment {
id: string;

adjustment_type: 'usage_discount';
adjustment_type: 'percentage_discount';

/**
* The value applied by an adjustment.
*/
amount: string;

/**
* The price IDs that this adjustment applies to.
Expand All @@ -222,27 +231,27 @@ export namespace InvoiceLineItemCreateResponse {
is_invoice_level: boolean;

/**
* The plan phase in which this adjustment is active.
* The percentage (as a value between 0 and 1) by which to discount the price
* intervals this adjustment applies to in a given billing period.
*/
plan_phase_order: number | null;
percentage_discount: number;

/**
* The reason for the adjustment.
*/
reason: string | null;

/**
* The number of usage units by which to discount the price this adjustment applies
* to in a given billing period.
*/
usage_discount: number;
}

export interface MinimumAdjustment {
export interface MonetaryMinimumAdjustment {
id: string;

adjustment_type: 'minimum';

/**
* The value applied by an adjustment.
*/
amount: string;

/**
* The price IDs that this adjustment applies to.
*/
Expand All @@ -265,22 +274,22 @@ export namespace InvoiceLineItemCreateResponse {
*/
minimum_amount: string;

/**
* The plan phase in which this adjustment is active.
*/
plan_phase_order: number | null;

/**
* The reason for the adjustment.
*/
reason: string | null;
}

export interface MaximumAdjustment {
export interface MonetaryMaximumAdjustment {
id: string;

adjustment_type: 'maximum';

/**
* The value applied by an adjustment.
*/
amount: string;

/**
* The price IDs that this adjustment applies to.
*/
Expand All @@ -298,11 +307,6 @@ export namespace InvoiceLineItemCreateResponse {
*/
maximum_amount: string;

/**
* The plan phase in which this adjustment is active.
*/
plan_phase_order: number | null;

/**
* The reason for the adjustment.
*/
Expand Down
Loading