diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e99be4da..58c53eae 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.50.0" + ".": "4.51.0" } diff --git a/.stats.yml b/.stats.yml index f878d0a8..efeca04e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 101 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-e480186cdd0e2cc631befa7e2c6ba5f2d7ae52052f0e79a748214f3ade8a98ee.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-7fca89ba5a0b4997358c25e6cdfb616a1d8b93a6820e25078f3fa5f61110bfe6.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index bfcc3e15..c81b3b96 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 4.51.0 (2025-01-21) + +Full Changelog: [v4.50.0...v4.51.0](https://github.com/orbcorp/orb-node/compare/v4.50.0...v4.51.0) + +### Features + +* **api:** api update ([#480](https://github.com/orbcorp/orb-node/issues/480)) ([fe6e3a7](https://github.com/orbcorp/orb-node/commit/fe6e3a706654bda3b1e8688c9d3a3cd6dc880a62)) + + +### Chores + +* **internal:** add test ([#475](https://github.com/orbcorp/orb-node/issues/475)) ([3654805](https://github.com/orbcorp/orb-node/commit/3654805e3427da36e0b1bf0c0cb08548a70ab8ee)) + + +### Documentation + +* update deprecation messages ([#478](https://github.com/orbcorp/orb-node/issues/478)) ([2e2382e](https://github.com/orbcorp/orb-node/commit/2e2382ee0ced57e41f44c83474dd0ac802e85d23)) + ## 4.50.0 (2025-01-18) Full Changelog: [v4.49.0...v4.50.0](https://github.com/orbcorp/orb-node/compare/v4.49.0...v4.50.0) diff --git a/package.json b/package.json index 1cf78c99..cd6a031d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.50.0", + "version": "4.51.0", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", diff --git a/src/resources/customers/customers.ts b/src/resources/customers/customers.ts index c9990570..4e2b2bb2 100644 --- a/src/resources/customers/customers.ts +++ b/src/resources/customers/customers.ts @@ -96,7 +96,9 @@ export class Customers extends APIResource { * provided the customer does not have any issued invoices. Customers with issued * invoices cannot be deleted. This operation is irreversible. Note that this is a * _soft_ deletion, but the data will be inaccessible through the API and Orb - * dashboard. For a hard-deletion, please reach out to the Orb team directly. + * dashboard. + * + * For a hard-deletion, please reach out to the Orb team directly. * * **Note**: This operation happens asynchronously and can be expected to take a * few minutes to propagate to related resources. However, querying for the diff --git a/src/resources/events/backfills.ts b/src/resources/events/backfills.ts index e81dd1cf..3dd66259 100644 --- a/src/resources/events/backfills.ts +++ b/src/resources/events/backfills.ts @@ -38,7 +38,7 @@ export class Backfills extends APIResource { * affect all customers. * * When `replace_existing_events` is `true`, this indicates that existing events in - * the timeframe should no longer be counter towards invoiced usage. In this + * the timeframe should no longer be counted towards invoiced usage. In this * scenario, the parameter `filter` can be optionally added which enables filtering * using * [computed properties](/extensibility/advanced-metrics#computed-properties). The diff --git a/src/resources/invoices.ts b/src/resources/invoices.ts index a1a22ec0..3f18ac11 100644 --- a/src/resources/invoices.ts +++ b/src/resources/invoices.ts @@ -287,7 +287,7 @@ export interface Invoice { customer_tax_id: Invoice.CustomerTaxID | null; /** - * @deprecated: This field is deprecated in favor of `discounts`. If a `discounts` + * @deprecated This field is deprecated in favor of `discounts`. If a `discounts` * list is provided, the first discount in the list will be returned. If the list * is empty, `None` will be returned. */ @@ -1277,7 +1277,7 @@ export interface InvoiceFetchUpcomingResponse { customer_tax_id: InvoiceFetchUpcomingResponse.CustomerTaxID | null; /** - * @deprecated: This field is deprecated in favor of `discounts`. If a `discounts` + * @deprecated This field is deprecated in favor of `discounts`. If a `discounts` * list is provided, the first discount in the list will be returned. If the list * is empty, `None` will be returned. */ diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index e57b26a7..35bf31e6 100644 --- a/src/resources/plans/plans.ts +++ b/src/resources/plans/plans.ts @@ -106,7 +106,7 @@ export interface Plan { created_at: string; /** - * @deprecated: An ISO 4217 currency string or custom pricing unit (`credits`) for + * @deprecated An ISO 4217 currency string or custom pricing unit (`credits`) for * this plan's prices. */ currency: string; @@ -497,6 +497,7 @@ export interface PlanCreateParams { | PlanCreateParams.NewPlanMatrixWithDisplayNamePrice | PlanCreateParams.NewPlanBulkWithProrationPrice | PlanCreateParams.NewPlanGroupedTieredPackagePrice + | PlanCreateParams.NewPlanMaxGroupTieredPrice >; /** @@ -3071,6 +3072,119 @@ export namespace PlanCreateParams { duration_unit: 'day' | 'month'; } } + + export interface NewPlanMaxGroupTieredPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + max_group_tiered_config: Record; + + model_type: 'max_group_tiered'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: NewPlanMaxGroupTieredPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An ISO 4217 currency string, or custom pricing unit identifier, in which this + * price is billed. + */ + currency?: string | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: NewPlanMaxGroupTieredPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared + * by setting `metadata` to `null`. + */ + metadata?: Record | null; + } + + export namespace NewPlanMaxGroupTieredPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } } export interface PlanUpdateParams { diff --git a/src/resources/prices/prices.ts b/src/resources/prices/prices.ts index 9de9c182..793a3372 100644 --- a/src/resources/prices/prices.ts +++ b/src/resources/prices/prices.ts @@ -146,7 +146,8 @@ export type Price = | Price.GroupedWithMeteredMinimumPrice | Price.MatrixWithDisplayNamePrice | Price.BulkWithProrationPrice - | Price.GroupedTieredPackagePrice; + | Price.GroupedTieredPackagePrice + | Price.MaxGroupTieredPrice; export namespace Price { export interface UnitPrice { @@ -2997,6 +2998,116 @@ export namespace Price { minimum_amount: string; } } + + export interface MaxGroupTieredPrice { + id: string; + + billable_metric: MaxGroupTieredPrice.BillableMetric | null; + + billing_cycle_configuration: MaxGroupTieredPrice.BillingCycleConfiguration; + + cadence: 'one_time' | 'monthly' | 'quarterly' | 'semi_annual' | 'annual' | 'custom'; + + conversion_rate: number | null; + + created_at: string; + + credit_allocation: MaxGroupTieredPrice.CreditAllocation | null; + + currency: string; + + discount: Shared.Discount | null; + + external_price_id: string | null; + + fixed_price_quantity: number | null; + + invoicing_cycle_configuration: MaxGroupTieredPrice.InvoicingCycleConfiguration | null; + + item: MaxGroupTieredPrice.Item; + + max_group_tiered_config: Record; + + maximum: MaxGroupTieredPrice.Maximum | null; + + maximum_amount: string | null; + + /** + * User specified key-value pairs for the resource. If not present, this defaults + * to an empty dictionary. Individual keys can be removed by setting the value to + * `null`, and the entire metadata mapping can be cleared by setting `metadata` to + * `null`. + */ + metadata: Record; + + minimum: MaxGroupTieredPrice.Minimum | null; + + minimum_amount: string | null; + + model_type: 'max_group_tiered'; + + name: string; + + plan_phase_order: number | null; + + price_type: 'usage_price' | 'fixed_price'; + } + + export namespace MaxGroupTieredPrice { + export interface BillableMetric { + id: string; + } + + export interface BillingCycleConfiguration { + duration: number; + + duration_unit: 'day' | 'month'; + } + + export interface CreditAllocation { + allows_rollover: boolean; + + currency: string; + } + + export interface InvoicingCycleConfiguration { + duration: number; + + duration_unit: 'day' | 'month'; + } + + export interface Item { + id: string; + + name: string; + } + + export interface Maximum { + /** + * List of price_ids that this maximum amount applies to. For plan/plan phase + * maximums, this can be a subset of prices. + */ + applies_to_price_ids: Array; + + /** + * Maximum amount applied + */ + maximum_amount: string; + } + + export interface Minimum { + /** + * List of price_ids that this minimum amount applies to. For plan/plan phase + * minimums, this can be a subset of prices. + */ + applies_to_price_ids: Array; + + /** + * Minimum amount applied + */ + minimum_amount: string; + } + } } export interface PriceEvaluateResponse { @@ -3016,6 +3127,7 @@ export type PriceCreateParams = | PriceCreateParams.NewFloatingThresholdTotalAmountPrice | PriceCreateParams.NewFloatingTieredPackagePrice | PriceCreateParams.NewFloatingGroupedTieredPrice + | PriceCreateParams.NewFloatingMaxGroupTieredPrice | PriceCreateParams.NewFloatingTieredWithMinimumPrice | PriceCreateParams.NewFloatingPackageWithAllocationPrice | PriceCreateParams.NewFloatingTieredPackageWithMinimumPrice @@ -4583,6 +4695,118 @@ export declare namespace PriceCreateParams { } } + export interface NewFloatingMaxGroupTieredPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + /** + * An ISO 4217 currency string for which this price is billed in. + */ + currency: string; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + max_group_tiered_config: Record; + + model_type: 'max_group_tiered'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: PriceCreateParams.NewFloatingMaxGroupTieredPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: PriceCreateParams.NewFloatingMaxGroupTieredPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared + * by setting `metadata` to `null`. + */ + metadata?: Record | null; + } + + export namespace NewFloatingMaxGroupTieredPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } + export interface NewFloatingTieredWithMinimumPrice { /** * The cadence to bill for this price on. diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 67a4cc57..75ceaabe 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -8158,7 +8158,7 @@ export namespace SubscriptionCreateParams { export interface AddPrice { /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's * discounts for this price. */ discounts?: Array | null; @@ -8176,14 +8176,14 @@ export namespace SubscriptionCreateParams { external_price_id?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * maximum amount for this price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's maximum + * amount for this price. */ maximum_amount?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * minimum amount for this price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's minimum + * amount for this price. */ minimum_amount?: string | null; @@ -10723,7 +10723,7 @@ export namespace SubscriptionCreateParams { replaces_price_id: string; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's * discounts for the replacement price. */ discounts?: Array | null; @@ -10739,14 +10739,14 @@ export namespace SubscriptionCreateParams { fixed_price_quantity?: number | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * maximum amount for the replacement price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's maximum + * amount for the replacement price. */ maximum_amount?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * minimum amount for the replacement price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's minimum + * amount for the replacement price. */ minimum_amount?: string | null; @@ -13351,6 +13351,7 @@ export namespace SubscriptionPriceIntervalsParams { | Add.NewFloatingThresholdTotalAmountPrice | Add.NewFloatingTieredPackagePrice | Add.NewFloatingGroupedTieredPrice + | Add.NewFloatingMaxGroupTieredPrice | Add.NewFloatingTieredWithMinimumPrice | Add.NewFloatingPackageWithAllocationPrice | Add.NewFloatingTieredPackageWithMinimumPrice @@ -14993,6 +14994,118 @@ export namespace SubscriptionPriceIntervalsParams { } } + export interface NewFloatingMaxGroupTieredPrice { + /** + * The cadence to bill for this price on. + */ + cadence: 'annual' | 'semi_annual' | 'monthly' | 'quarterly' | 'one_time' | 'custom'; + + /** + * An ISO 4217 currency string for which this price is billed in. + */ + currency: string; + + /** + * The id of the item the plan will be associated with. + */ + item_id: string; + + max_group_tiered_config: Record; + + model_type: 'max_group_tiered'; + + /** + * The name of the price. + */ + name: string; + + /** + * The id of the billable metric for the price. Only needed if the price is + * usage-based. + */ + billable_metric_id?: string | null; + + /** + * If the Price represents a fixed cost, the price will be billed in-advance if + * this is true, and in-arrears if this is false. + */ + billed_in_advance?: boolean | null; + + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + billing_cycle_configuration?: NewFloatingMaxGroupTieredPrice.BillingCycleConfiguration | null; + + /** + * The per unit conversion rate of the price currency to the invoicing currency. + */ + conversion_rate?: number | null; + + /** + * An alias for the price. + */ + external_price_id?: string | null; + + /** + * If the Price represents a fixed cost, this represents the quantity of units + * applied. + */ + fixed_price_quantity?: number | null; + + /** + * The property used to group this price on an invoice + */ + invoice_grouping_key?: string | null; + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + invoicing_cycle_configuration?: NewFloatingMaxGroupTieredPrice.InvoicingCycleConfiguration | null; + + /** + * User-specified key/value pairs for the resource. Individual keys can be removed + * by setting the value to `null`, and the entire metadata mapping can be cleared + * by setting `metadata` to `null`. + */ + metadata?: Record | null; + } + + export namespace NewFloatingMaxGroupTieredPrice { + /** + * For custom cadence: specifies the duration of the billing period in days or + * months. + */ + export interface BillingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + + /** + * Within each billing cycle, specifies the cadence at which invoices are produced. + * If unspecified, a single invoice is produced per billing cycle. + */ + export interface InvoicingCycleConfiguration { + /** + * The duration of the billing period. + */ + duration: number; + + /** + * The unit of billing period duration. + */ + duration_unit: 'day' | 'month'; + } + } + export interface NewFloatingTieredWithMinimumPrice { /** * The cadence to bill for this price on. @@ -16560,7 +16673,8 @@ export interface SubscriptionSchedulePlanChangeParams { /** * The date that the plan change should take effect. This parameter can only be - * passed if the `change_option` is `requested_date`. + * passed if the `change_option` is `requested_date`. If a date with no time is + * passed, the plan change will happen at midnight in the customer's timezone. */ change_date?: string | null; @@ -16790,7 +16904,7 @@ export namespace SubscriptionSchedulePlanChangeParams { export interface AddPrice { /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's * discounts for this price. */ discounts?: Array | null; @@ -16808,14 +16922,14 @@ export namespace SubscriptionSchedulePlanChangeParams { external_price_id?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * maximum amount for this price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's maximum + * amount for this price. */ maximum_amount?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * minimum amount for this price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's minimum + * amount for this price. */ minimum_amount?: string | null; @@ -19355,7 +19469,7 @@ export namespace SubscriptionSchedulePlanChangeParams { replaces_price_id: string; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's * discounts for the replacement price. */ discounts?: Array | null; @@ -19371,14 +19485,14 @@ export namespace SubscriptionSchedulePlanChangeParams { fixed_price_quantity?: number | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * maximum amount for the replacement price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's maximum + * amount for the replacement price. */ maximum_amount?: string | null; /** - * @deprecated: [DEPRECATED] Use add_adjustments instead. The subscription's - * minimum amount for the replacement price. + * @deprecated [DEPRECATED] Use add_adjustments instead. The subscription's minimum + * amount for the replacement price. */ minimum_amount?: string | null; diff --git a/src/version.ts b/src/version.ts index 44f8e47e..9daf60a2 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.50.0'; // x-release-please-version +export const VERSION = '4.51.0'; // x-release-please-version diff --git a/tests/index.test.ts b/tests/index.test.ts index 4c4b1ef4..3e2a325a 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -96,6 +96,11 @@ describe('instantiate client', () => { expect(response).toEqual({ url: 'http://localhost:5000/foo', custom: true }); }); + test('explicit global fetch', async () => { + // make sure the global fetch type is assignable to our Fetch type + const client = new Orb({ baseURL: 'http://localhost:5000/', apiKey: 'My API Key', fetch: defaultFetch }); + }); + test('custom signal', async () => { const client = new Orb({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',