diff --git a/.release-please-manifest.json b/.release-please-manifest.json index a2b09ee3..e5b450ff 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "4.32.0" + ".": "4.33.0" } diff --git a/.stats.yml b/.stats.yml index f433eea6..14eb001b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 95 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-ba6405a18533c3a25d39dd75a279ef46ce41d33d478441376ecd3ebd54f9088c.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-97c8d75c5095cb134ab45f92a057797013d174324268fcf1ba750c5ebcd9b3e4.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index ab12282f..8018cf78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 4.33.0 (2024-11-06) + +Full Changelog: [v4.32.0...v4.33.0](https://github.com/orbcorp/orb-node/compare/v4.32.0...v4.33.0) + +### Features + +* **api:** api update ([#379](https://github.com/orbcorp/orb-node/issues/379)) ([43a40be](https://github.com/orbcorp/orb-node/commit/43a40be638be51f8bcc62e7bad4a822f3af5b7c0)) +* **api:** api update ([#381](https://github.com/orbcorp/orb-node/issues/381)) ([789f363](https://github.com/orbcorp/orb-node/commit/789f36319272f2488cc848789e815cb071c10f27)) + ## 4.32.0 (2024-10-22) Full Changelog: [v4.31.0...v4.32.0](https://github.com/orbcorp/orb-node/compare/v4.31.0...v4.32.0) diff --git a/README.md b/README.md index d3044e32..81a5054f 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Note that requests which time out will be [retried twice by default](#retries). ## Auto-pagination List methods in the Orb API are paginated. -You can use `for await … of` syntax to iterate through items across all pages: +You can use the `for await … of` syntax to iterate through items across all pages: ```ts async function fetchAllCoupons(params) { @@ -154,7 +154,7 @@ async function fetchAllCoupons(params) { } ``` -Alternatively, you can make request a single page at a time: +Alternatively, you can request a single page at a time: ```ts let page = await client.coupons.list(); diff --git a/package.json b/package.json index c5783f4a..dd143ac3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "orb-billing", - "version": "4.32.0", + "version": "4.33.0", "description": "The official TypeScript library for the Orb API", "author": "Orb ", "types": "dist/index.d.ts", @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { diff --git a/src/resources/customers/customers.ts b/src/resources/customers/customers.ts index b712f7ab..9e9b0ebf 100644 --- a/src/resources/customers/customers.ts +++ b/src/resources/customers/customers.ts @@ -42,18 +42,9 @@ export class Customers extends APIResource { */ update( customerId: string, - body?: CustomerUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(customerId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - customerId: string, - body: CustomerUpdateParams | Core.RequestOptions = {}, + body: CustomerUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(customerId, {}, body); - } return this._client.put(`/customers/${customerId}`, { body, ...options }); } @@ -131,18 +122,9 @@ export class Customers extends APIResource { */ updateByExternalId( id: string, - body?: CustomerUpdateByExternalIDParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - updateByExternalId(id: string, options?: Core.RequestOptions): Core.APIPromise; - updateByExternalId( - id: string, - body: CustomerUpdateByExternalIDParams | Core.RequestOptions = {}, + body: CustomerUpdateByExternalIDParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.updateByExternalId(id, {}, body); - } return this._client.put(`/customers/external_customer_id/${id}`, { body, ...options }); } } diff --git a/src/resources/events/volume.ts b/src/resources/events/volume.ts index 2d028a42..49a73919 100644 --- a/src/resources/events/volume.ts +++ b/src/resources/events/volume.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as VolumeAPI from './volume'; @@ -21,15 +20,7 @@ export class Volume extends APIResource { * timestamp is passed in for either start or end time, the response includes the * hours the timestamp falls in. */ - list(query?: VolumeListParams, options?: Core.RequestOptions): Core.APIPromise; - list(options?: Core.RequestOptions): Core.APIPromise; - list( - query: VolumeListParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.list({}, query); - } + list(query: VolumeListParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.get('/events/volume', { query, ...options }); } } @@ -56,6 +47,14 @@ export namespace EventVolumes { } export interface VolumeListParams { + /** + * The start of the timeframe, inclusive, in which to return event volume. All + * datetime values are converted to UTC time. If the specified time isn't + * hour-aligned, the response includes the event volume count for the hour the time + * falls in. + */ + timeframe_start: string; + /** * Cursor for pagination. This can be populated by the `next_cursor` value returned * from the initial request. @@ -74,14 +73,6 @@ export interface VolumeListParams { * volumecount for the hour the time falls in. */ timeframe_end?: string; - - /** - * The start of the timeframe, inclusive, in which to return event volume. All - * datetime values are converted to UTC time. If the specified time isn't - * hour-aligned, the response includes the event volume count for the hour the time - * falls in. - */ - timeframe_start?: string; } export namespace Volume { diff --git a/src/resources/invoices.ts b/src/resources/invoices.ts index d7bf3d26..d81391d0 100644 --- a/src/resources/invoices.ts +++ b/src/resources/invoices.ts @@ -25,18 +25,9 @@ export class Invoices extends APIResource { */ update( invoiceId: string, - body?: InvoiceUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(invoiceId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - invoiceId: string, - body: InvoiceUpdateParams | Core.RequestOptions = {}, + body: InvoiceUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(invoiceId, {}, body); - } return this._client.put(`/invoices/${invoiceId}`, { body, ...options }); } @@ -81,17 +72,9 @@ export class Invoices extends APIResource { * subscription. */ fetchUpcoming( - query?: InvoiceFetchUpcomingParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - fetchUpcoming(options?: Core.RequestOptions): Core.APIPromise; - fetchUpcoming( - query: InvoiceFetchUpcomingParams | Core.RequestOptions = {}, + query: InvoiceFetchUpcomingParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(query)) { - return this.fetchUpcoming({}, query); - } return this._client.get('/invoices/upcoming', { query, ...options }); } @@ -2647,7 +2630,7 @@ export interface InvoiceListParams extends PageParams { } export interface InvoiceFetchUpcomingParams { - subscription_id?: string; + subscription_id: string; } export interface InvoiceIssueParams { diff --git a/src/resources/items.ts b/src/resources/items.ts index cb221010..bce05d15 100644 --- a/src/resources/items.ts +++ b/src/resources/items.ts @@ -17,16 +17,7 @@ export class Items extends APIResource { /** * This endpoint can be used to update properties on the Item. */ - update(itemId: string, body?: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise; - update(itemId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - itemId: string, - body: ItemUpdateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(itemId, {}, body); - } + update(itemId: string, body: ItemUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.put(`/items/${itemId}`, { body, ...options }); } diff --git a/src/resources/metrics.ts b/src/resources/metrics.ts index 8f88e99c..d5ef8989 100644 --- a/src/resources/metrics.ts +++ b/src/resources/metrics.ts @@ -25,18 +25,9 @@ export class Metrics extends APIResource { */ update( metricId: string, - body?: MetricUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(metricId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - metricId: string, - body: MetricUpdateParams | Core.RequestOptions = {}, + body: MetricUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(metricId, {}, body); - } return this._client.put(`/metrics/${metricId}`, { body, ...options }); } diff --git a/src/resources/plans/external-plan-id.ts b/src/resources/plans/external-plan-id.ts index 61b6ee48..692ce5a5 100644 --- a/src/resources/plans/external-plan-id.ts +++ b/src/resources/plans/external-plan-id.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as ExternalPlanIDAPI from './external-plan-id'; import * as PlansAPI from './plans'; @@ -15,18 +14,9 @@ export class ExternalPlanID extends APIResource { */ update( otherExternalPlanId: string, - body?: ExternalPlanIDUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(otherExternalPlanId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - otherExternalPlanId: string, - body: ExternalPlanIDUpdateParams | Core.RequestOptions = {}, + body: ExternalPlanIDUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(otherExternalPlanId, {}, body); - } return this._client.put(`/plans/external_plan_id/${otherExternalPlanId}`, { body, ...options }); } diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index 45de58d1..0b7a6f63 100644 --- a/src/resources/plans/plans.ts +++ b/src/resources/plans/plans.ts @@ -25,16 +25,7 @@ export class Plans extends APIResource { * * Other fields on a customer are currently immutable. */ - update(planId: string, body?: PlanUpdateParams, options?: Core.RequestOptions): Core.APIPromise; - update(planId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - planId: string, - body: PlanUpdateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(planId, {}, body); - } + update(planId: string, body: PlanUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.put(`/plans/${planId}`, { body, ...options }); } diff --git a/src/resources/prices/external-price-id.ts b/src/resources/prices/external-price-id.ts index 4e54c96d..9c551717 100644 --- a/src/resources/prices/external-price-id.ts +++ b/src/resources/prices/external-price-id.ts @@ -1,7 +1,6 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../resource'; -import { isRequestOptions } from '../../core'; import * as Core from '../../core'; import * as ExternalPriceIDAPI from './external-price-id'; import * as PricesAPI from './prices'; @@ -14,18 +13,9 @@ export class ExternalPriceID extends APIResource { */ update( externalPriceId: string, - body?: ExternalPriceIDUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(externalPriceId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - externalPriceId: string, - body: ExternalPriceIDUpdateParams | Core.RequestOptions = {}, + body: ExternalPriceIDUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(externalPriceId, {}, body); - } return this._client.put(`/prices/external_price_id/${externalPriceId}`, { body, ...options }); } diff --git a/src/resources/prices/prices.ts b/src/resources/prices/prices.ts index efe93665..78a51851 100644 --- a/src/resources/prices/prices.ts +++ b/src/resources/prices/prices.ts @@ -32,16 +32,7 @@ export class Prices extends APIResource { * pass null for the metadata value, it will clear any existing metadata for that * price. */ - update(priceId: string, body?: PriceUpdateParams, options?: Core.RequestOptions): Core.APIPromise; - update(priceId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - priceId: string, - body: PriceUpdateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(priceId, {}, body); - } + update(priceId: string, body: PriceUpdateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.put(`/prices/${priceId}`, { body, ...options }); } diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index 8090a296..a5819185 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -47,8 +47,9 @@ export class Subscriptions extends APIResource { * subscription being created. This is useful when a customer has prices that * differ from the default prices for a specific plan. * - * :::info This feature is only available for accounts that have migrated off of - * legacy subscription overrides. ::: + * :::info This feature is only available for accounts that have migrated to + * Subscription Overrides Version 2. You can find your Subscription Overrides + * Version at the bottom of your [Plans page](https://app.withorb.com/plans) ::: * * ### Adding Prices * @@ -266,15 +267,7 @@ export class Subscriptions extends APIResource { * subscription. E.g. pass in `10.00` to issue an invoice when usage amounts hit * $10.00 for a subscription that invoices in USD. */ - create(body?: SubscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise; - create(options?: Core.RequestOptions): Core.APIPromise; - create( - body: SubscriptionCreateParams | Core.RequestOptions = {}, - options?: Core.RequestOptions, - ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.create({}, body); - } + create(body: SubscriptionCreateParams, options?: Core.RequestOptions): Core.APIPromise { return this._client.post('/subscriptions', { body, ...options }); } @@ -285,18 +278,9 @@ export class Subscriptions extends APIResource { */ update( subscriptionId: string, - body?: SubscriptionUpdateParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - update(subscriptionId: string, options?: Core.RequestOptions): Core.APIPromise; - update( - subscriptionId: string, - body: SubscriptionUpdateParams | Core.RequestOptions = {}, + body: SubscriptionUpdateParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.update(subscriptionId, {}, body); - } return this._client.put(`/subscriptions/${subscriptionId}`, { body, ...options }); } @@ -756,18 +740,9 @@ export class Subscriptions extends APIResource { */ priceIntervals( subscriptionId: string, - body?: SubscriptionPriceIntervalsParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - priceIntervals(subscriptionId: string, options?: Core.RequestOptions): Core.APIPromise; - priceIntervals( - subscriptionId: string, - body: SubscriptionPriceIntervalsParams | Core.RequestOptions = {}, + body: SubscriptionPriceIntervalsParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.priceIntervals(subscriptionId, {}, body); - } return this._client.post(`/subscriptions/${subscriptionId}/price_intervals`, { body, ...options }); } @@ -816,8 +791,9 @@ export class Subscriptions extends APIResource { * subscription when you schedule the plan change. This is useful when a customer * has prices that differ from the default prices for a specific plan. * - * :::info This feature is only available for accounts that have migrated off of - * legacy subscription overrides. ::: + * :::info This feature is only available for accounts that have migrated to + * Subscription Overrides Version 2. You can find your Subscription Overrides + * Version at the bottom of your [Plans page](https://app.withorb.com/plans) ::: * * ### Adding Prices * @@ -966,18 +942,9 @@ export class Subscriptions extends APIResource { */ triggerPhase( subscriptionId: string, - body?: SubscriptionTriggerPhaseParams, - options?: Core.RequestOptions, - ): Core.APIPromise; - triggerPhase(subscriptionId: string, options?: Core.RequestOptions): Core.APIPromise; - triggerPhase( - subscriptionId: string, - body: SubscriptionTriggerPhaseParams | Core.RequestOptions = {}, + body: SubscriptionTriggerPhaseParams, options?: Core.RequestOptions, ): Core.APIPromise { - if (isRequestOptions(body)) { - return this.triggerPhase(subscriptionId, {}, body); - } return this._client.post(`/subscriptions/${subscriptionId}/trigger_phase`, { body, ...options }); } diff --git a/src/version.ts b/src/version.ts index 7e04c79b..6726dc21 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const VERSION = '4.32.0'; // x-release-please-version +export const VERSION = '4.33.0'; // x-release-please-version diff --git a/tests/api-resources/customers/customers.test.ts b/tests/api-resources/customers/customers.test.ts index 8cd24d77..2ae7d375 100644 --- a/tests/api-resources/customers/customers.test.ts +++ b/tests/api-resources/customers/customers.test.ts @@ -68,7 +68,7 @@ describe('resource customers', () => { }); test('update', async () => { - const responsePromise = client.customers.update('customer_id'); + const responsePromise = client.customers.update('customer_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -78,66 +78,6 @@ describe('resource customers', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.customers.update('customer_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.customers.update( - 'customer_id', - { - accounting_sync_configuration: { - accounting_providers: [ - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - ], - excluded: true, - }, - additional_emails: ['string'], - auto_collection: true, - billing_address: { - city: 'city', - country: 'country', - line1: 'line1', - line2: 'line2', - postal_code: 'postal_code', - state: 'state', - }, - currency: 'currency', - email: 'dev@stainlessapi.com', - email_delivery: true, - external_customer_id: 'external_customer_id', - metadata: { foo: 'string' }, - name: 'name', - payment_provider: 'quickbooks', - payment_provider_id: 'payment_provider_id', - reporting_configuration: { exempt: true }, - shipping_address: { - city: 'city', - country: 'country', - line1: 'line1', - line2: 'line2', - postal_code: 'postal_code', - state: 'state', - }, - tax_configuration: { - tax_exempt: true, - tax_provider: 'avalara', - tax_exemption_code: 'tax_exemption_code', - }, - tax_id: { country: 'AD', type: 'ad_nrt', value: 'value' }, - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.customers.list(); const rawResponse = await responsePromise.asResponse(); @@ -228,7 +168,7 @@ describe('resource customers', () => { }); test('updateByExternalId', async () => { - const responsePromise = client.customers.updateByExternalId('external_customer_id'); + const responsePromise = client.customers.updateByExternalId('external_customer_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -237,64 +177,4 @@ describe('resource customers', () => { expect(dataAndResponse.data).toBe(response); expect(dataAndResponse.response).toBe(rawResponse); }); - - test('updateByExternalId: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.customers.updateByExternalId('external_customer_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('updateByExternalId: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.customers.updateByExternalId( - 'external_customer_id', - { - accounting_sync_configuration: { - accounting_providers: [ - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - { external_provider_id: 'external_provider_id', provider_type: 'provider_type' }, - ], - excluded: true, - }, - additional_emails: ['string'], - auto_collection: true, - billing_address: { - city: 'city', - country: 'country', - line1: 'line1', - line2: 'line2', - postal_code: 'postal_code', - state: 'state', - }, - currency: 'currency', - email: 'dev@stainlessapi.com', - email_delivery: true, - external_customer_id: 'external_customer_id', - metadata: { foo: 'string' }, - name: 'name', - payment_provider: 'quickbooks', - payment_provider_id: 'payment_provider_id', - reporting_configuration: { exempt: true }, - shipping_address: { - city: 'city', - country: 'country', - line1: 'line1', - line2: 'line2', - postal_code: 'postal_code', - state: 'state', - }, - tax_configuration: { - tax_exempt: true, - tax_provider: 'avalara', - tax_exemption_code: 'tax_exemption_code', - }, - tax_id: { country: 'AD', type: 'ad_nrt', value: 'value' }, - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); }); diff --git a/tests/api-resources/events/volume.test.ts b/tests/api-resources/events/volume.test.ts index 584a68f0..4ab6a069 100644 --- a/tests/api-resources/events/volume.test.ts +++ b/tests/api-resources/events/volume.test.ts @@ -9,8 +9,8 @@ const client = new Orb({ }); describe('resource volume', () => { - test('list', async () => { - const responsePromise = client.events.volume.list(); + test('list: only required params', async () => { + const responsePromise = client.events.volume.list({ timeframe_start: '2019-12-27T18:11:19.117Z' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,25 +20,12 @@ describe('resource volume', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('list: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.events.volume.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('list: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.events.volume.list( - { - cursor: 'cursor', - limit: 1, - timeframe_end: '2024-10-11T06:00:00Z', - timeframe_start: '2019-12-27T18:11:19.117Z', - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); + test('list: required and optional params', async () => { + const response = await client.events.volume.list({ + timeframe_start: '2019-12-27T18:11:19.117Z', + cursor: 'cursor', + limit: 1, + timeframe_end: '2024-10-11T06:00:00Z', + }); }); }); diff --git a/tests/api-resources/invoices.test.ts b/tests/api-resources/invoices.test.ts index 474257da..585d58b4 100644 --- a/tests/api-resources/invoices.test.ts +++ b/tests/api-resources/invoices.test.ts @@ -66,7 +66,7 @@ describe('resource invoices', () => { }); test('update', async () => { - const responsePromise = client.invoices.update('invoice_id'); + const responsePromise = client.invoices.update('invoice_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -76,24 +76,6 @@ describe('resource invoices', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.invoices.update('invoice_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.invoices.update( - 'invoice_id', - { metadata: { foo: 'string' } }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.invoices.list(); const rawResponse = await responsePromise.asResponse(); @@ -160,8 +142,8 @@ describe('resource invoices', () => { ); }); - test('fetchUpcoming', async () => { - const responsePromise = client.invoices.fetchUpcoming(); + test('fetchUpcoming: only required params', async () => { + const responsePromise = client.invoices.fetchUpcoming({ subscription_id: 'subscription_id' }); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -171,21 +153,8 @@ describe('resource invoices', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('fetchUpcoming: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.invoices.fetchUpcoming({ path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('fetchUpcoming: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.invoices.fetchUpcoming( - { subscription_id: 'subscription_id' }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); + test('fetchUpcoming: required and optional params', async () => { + const response = await client.invoices.fetchUpcoming({ subscription_id: 'subscription_id' }); }); test('issue', async () => { diff --git a/tests/api-resources/items.test.ts b/tests/api-resources/items.test.ts index 0547ce91..c04b5a7c 100644 --- a/tests/api-resources/items.test.ts +++ b/tests/api-resources/items.test.ts @@ -25,7 +25,7 @@ describe('resource items', () => { }); test('update', async () => { - const responsePromise = client.items.update('item_id'); + const responsePromise = client.items.update('item_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -35,31 +35,6 @@ describe('resource items', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.items.update('item_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.items.update( - 'item_id', - { - external_connections: [ - { external_connection_name: 'stripe', external_entity_id: 'external_entity_id' }, - { external_connection_name: 'stripe', external_entity_id: 'external_entity_id' }, - { external_connection_name: 'stripe', external_entity_id: 'external_entity_id' }, - ], - name: 'name', - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.items.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/metrics.test.ts b/tests/api-resources/metrics.test.ts index 3687b2c1..0c505013 100644 --- a/tests/api-resources/metrics.test.ts +++ b/tests/api-resources/metrics.test.ts @@ -36,7 +36,7 @@ describe('resource metrics', () => { }); test('update', async () => { - const responsePromise = client.metrics.update('metric_id'); + const responsePromise = client.metrics.update('metric_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -46,24 +46,6 @@ describe('resource metrics', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.metrics.update('metric_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.metrics.update( - 'metric_id', - { metadata: { foo: 'string' } }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.metrics.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/plans/external-plan-id.test.ts b/tests/api-resources/plans/external-plan-id.test.ts index f31f7de4..a0a61409 100644 --- a/tests/api-resources/plans/external-plan-id.test.ts +++ b/tests/api-resources/plans/external-plan-id.test.ts @@ -10,7 +10,7 @@ const client = new Orb({ describe('resource externalPlanId', () => { test('update', async () => { - const responsePromise = client.plans.externalPlanId.update('external_plan_id'); + const responsePromise = client.plans.externalPlanId.update('external_plan_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,24 +20,6 @@ describe('resource externalPlanId', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.plans.externalPlanId.update('external_plan_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.plans.externalPlanId.update( - 'external_plan_id', - { external_plan_id: 'external_plan_id', metadata: { foo: 'string' } }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('fetch', async () => { const responsePromise = client.plans.externalPlanId.fetch('external_plan_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/plans/plans.test.ts b/tests/api-resources/plans/plans.test.ts index 60a00919..8cb366a7 100644 --- a/tests/api-resources/plans/plans.test.ts +++ b/tests/api-resources/plans/plans.test.ts @@ -64,7 +64,7 @@ describe('resource plans', () => { }); test('update', async () => { - const responsePromise = client.plans.update('plan_id'); + const responsePromise = client.plans.update('plan_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -74,24 +74,6 @@ describe('resource plans', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.plans.update('plan_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.plans.update( - 'plan_id', - { external_plan_id: 'external_plan_id', metadata: { foo: 'string' } }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.plans.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/prices/external-price-id.test.ts b/tests/api-resources/prices/external-price-id.test.ts index 880c6858..99a0a2d4 100644 --- a/tests/api-resources/prices/external-price-id.test.ts +++ b/tests/api-resources/prices/external-price-id.test.ts @@ -10,7 +10,7 @@ const client = new Orb({ describe('resource externalPriceId', () => { test('update', async () => { - const responsePromise = client.prices.externalPriceId.update('external_price_id'); + const responsePromise = client.prices.externalPriceId.update('external_price_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,24 +20,6 @@ describe('resource externalPriceId', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.prices.externalPriceId.update('external_price_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.prices.externalPriceId.update( - 'external_price_id', - { metadata: { foo: 'string' } }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('fetch', async () => { const responsePromise = client.prices.externalPriceId.fetch('external_price_id'); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/prices/prices.test.ts b/tests/api-resources/prices/prices.test.ts index bc301e3a..e41c5cc2 100644 --- a/tests/api-resources/prices/prices.test.ts +++ b/tests/api-resources/prices/prices.test.ts @@ -48,7 +48,7 @@ describe('resource prices', () => { }); test('update', async () => { - const responsePromise = client.prices.update('price_id'); + const responsePromise = client.prices.update('price_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -58,20 +58,6 @@ describe('resource prices', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.prices.update('price_id', { path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.prices.update('price_id', { metadata: { foo: 'string' } }, { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.prices.list(); const rawResponse = await responsePromise.asResponse(); diff --git a/tests/api-resources/subscriptions.test.ts b/tests/api-resources/subscriptions.test.ts index 86b61c69..302a638a 100644 --- a/tests/api-resources/subscriptions.test.ts +++ b/tests/api-resources/subscriptions.test.ts @@ -10,7 +10,7 @@ const client = new Orb({ describe('resource subscriptions', () => { test('create', async () => { - const responsePromise = client.subscriptions.create(); + const responsePromise = client.subscriptions.create({}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -20,400 +20,8 @@ describe('resource subscriptions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('create: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect(client.subscriptions.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( - Orb.NotFoundError, - ); - }); - - test('create: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.create( - { - add_adjustments: [ - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - end_date: '2019-12-27T18:11:19.117Z', - plan_phase_order: 0, - start_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - end_date: '2019-12-27T18:11:19.117Z', - plan_phase_order: 0, - start_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - end_date: '2019-12-27T18:11:19.117Z', - plan_phase_order: 0, - start_date: '2019-12-27T18:11:19.117Z', - }, - ], - add_prices: [ - { - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - maximum_amount: '1.23', - minimum_amount: '1.23', - plan_phase_order: 0, - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - maximum_amount: '1.23', - minimum_amount: '1.23', - plan_phase_order: 0, - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - maximum_amount: '1.23', - minimum_amount: '1.23', - plan_phase_order: 0, - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - start_date: '2019-12-27T18:11:19.117Z', - }, - ], - align_billing_with_subscription_start_date: true, - auto_collection: true, - aws_region: 'aws_region', - billing_cycle_anchor_configuration: { day: 1, month: 1, year: 0 }, - coupon_redemption_code: 'coupon_redemption_code', - credits_overage_rate: 0, - customer_id: 'customer_id', - default_invoice_memo: 'default_invoice_memo', - end_date: '2019-12-27T18:11:19.117Z', - external_customer_id: 'external_customer_id', - external_marketplace: 'google', - external_marketplace_reporting_id: 'external_marketplace_reporting_id', - external_plan_id: 'ZMwNQefe7J3ecf7W', - initial_phase_order: 2, - invoicing_threshold: '10.00', - metadata: { foo: 'string' }, - net_terms: 0, - per_credit_overage_amount: 0, - plan_id: 'ZMwNQefe7J3ecf7W', - plan_version_number: 0, - price_overrides: [{}, {}, {}], - remove_adjustments: [ - { adjustment_id: 'h74gfhdjvn7ujokd' }, - { adjustment_id: 'h74gfhdjvn7ujokd' }, - { adjustment_id: 'h74gfhdjvn7ujokd' }, - ], - remove_prices: [ - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - { external_price_id: 'external_price_id', price_id: 'h74gfhdjvn7ujokd' }, - ], - replace_adjustments: [ - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - replaces_adjustment_id: 'replaces_adjustment_id', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - replaces_adjustment_id: 'replaces_adjustment_id', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - replaces_adjustment_id: 'replaces_adjustment_id', - }, - ], - replace_prices: [ - { - replaces_price_id: 'replaces_price_id', - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - external_price_id: 'external_price_id', - fixed_price_quantity: 2, - maximum_amount: '1.23', - minimum_amount: '1.23', - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - replaces_price_id: 'replaces_price_id', - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - external_price_id: 'external_price_id', - fixed_price_quantity: 2, - maximum_amount: '1.23', - minimum_amount: '1.23', - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - replaces_price_id: 'replaces_price_id', - discounts: [ - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - { - discount_type: 'percentage', - amount_discount: 'amount_discount', - percentage_discount: 0.15, - usage_discount: 0, - }, - ], - external_price_id: 'external_price_id', - fixed_price_quantity: 2, - maximum_amount: '1.23', - minimum_amount: '1.23', - price: { - cadence: 'annual', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - currency: 'currency', - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - reference_id: 'reference_id', - }, - price_id: 'h74gfhdjvn7ujokd', - }, - ], - start_date: '2019-12-27T18:11:19.117Z', - trial_duration_days: 0, - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('update', async () => { - const responsePromise = client.subscriptions.update('subscription_id'); + const responsePromise = client.subscriptions.update('subscription_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -423,30 +31,6 @@ describe('resource subscriptions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('update: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.update('subscription_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('update: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.update( - 'subscription_id', - { - auto_collection: true, - default_invoice_memo: 'default_invoice_memo', - invoicing_threshold: '10.00', - metadata: { foo: 'string' }, - net_terms: 0, - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('list', async () => { const responsePromise = client.subscriptions.list(); const rawResponse = await responsePromise.asResponse(); @@ -638,7 +222,7 @@ describe('resource subscriptions', () => { // Incorrect example breaks Prism test.skip('priceIntervals', async () => { - const responsePromise = client.subscriptions.priceIntervals('subscription_id'); + const responsePromise = client.subscriptions.priceIntervals('subscription_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -648,233 +232,6 @@ describe('resource subscriptions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - // Incorrect example breaks Prism - test.skip('priceIntervals: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.priceIntervals('subscription_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - // Incorrect example breaks Prism - test.skip('priceIntervals: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.priceIntervals( - 'subscription_id', - { - add: [ - { - start_date: '2019-12-27T18:11:19.117Z', - allocation_price: { - amount: '10.00', - cadence: 'one_time', - currency: 'USD', - expires_at_end_of_cadence: true, - }, - discounts: [ - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - maximum_amount: 0, - minimum_amount: 0, - price: { - cadence: 'annual', - currency: 'currency', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - start_date: '2019-12-27T18:11:19.117Z', - allocation_price: { - amount: '10.00', - cadence: 'one_time', - currency: 'USD', - expires_at_end_of_cadence: true, - }, - discounts: [ - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - maximum_amount: 0, - minimum_amount: 0, - price: { - cadence: 'annual', - currency: 'currency', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - }, - price_id: 'h74gfhdjvn7ujokd', - }, - { - start_date: '2019-12-27T18:11:19.117Z', - allocation_price: { - amount: '10.00', - cadence: 'one_time', - currency: 'USD', - expires_at_end_of_cadence: true, - }, - discounts: [ - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - { amount_discount: 0, discount_type: 'amount' }, - ], - end_date: '2019-12-27T18:11:19.117Z', - external_price_id: 'external_price_id', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - maximum_amount: 0, - minimum_amount: 0, - price: { - cadence: 'annual', - currency: 'currency', - item_id: 'item_id', - model_type: 'unit', - name: 'Annual fee', - unit_config: { unit_amount: 'unit_amount' }, - billable_metric_id: 'billable_metric_id', - billed_in_advance: true, - billing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - conversion_rate: 0, - external_price_id: 'external_price_id', - fixed_price_quantity: 0, - invoice_grouping_key: 'invoice_grouping_key', - invoicing_cycle_configuration: { duration: 0, duration_unit: 'day' }, - metadata: { foo: 'string' }, - }, - price_id: 'h74gfhdjvn7ujokd', - }, - ], - add_adjustments: [ - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - start_date: '2019-12-27T18:11:19.117Z', - end_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - start_date: '2019-12-27T18:11:19.117Z', - end_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment: { - adjustment_type: 'percentage_discount', - applies_to_price_ids: ['price_1', 'price_2'], - percentage_discount: 0, - }, - start_date: '2019-12-27T18:11:19.117Z', - end_date: '2019-12-27T18:11:19.117Z', - }, - ], - edit: [ - { - price_interval_id: 'sdfs6wdjvn7ujokd', - billing_cycle_day: 0, - end_date: '2019-12-27T18:11:19.117Z', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - start_date: '2019-12-27T18:11:19.117Z', - }, - { - price_interval_id: 'sdfs6wdjvn7ujokd', - billing_cycle_day: 0, - end_date: '2019-12-27T18:11:19.117Z', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - start_date: '2019-12-27T18:11:19.117Z', - }, - { - price_interval_id: 'sdfs6wdjvn7ujokd', - billing_cycle_day: 0, - end_date: '2019-12-27T18:11:19.117Z', - fixed_fee_quantity_transitions: [ - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - { effective_date: '2019-12-27T18:11:19.117Z', quantity: 5 }, - ], - start_date: '2019-12-27T18:11:19.117Z', - }, - ], - edit_adjustments: [ - { - adjustment_interval_id: 'sdfs6wdjvn7ujokd', - end_date: '2019-12-27T18:11:19.117Z', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment_interval_id: 'sdfs6wdjvn7ujokd', - end_date: '2019-12-27T18:11:19.117Z', - start_date: '2019-12-27T18:11:19.117Z', - }, - { - adjustment_interval_id: 'sdfs6wdjvn7ujokd', - end_date: '2019-12-27T18:11:19.117Z', - start_date: '2019-12-27T18:11:19.117Z', - }, - ], - }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('schedulePlanChange: only required params', async () => { const responsePromise = client.subscriptions.schedulePlanChange('subscription_id', { change_option: 'requested_date', @@ -1262,7 +619,7 @@ describe('resource subscriptions', () => { }); test('triggerPhase', async () => { - const responsePromise = client.subscriptions.triggerPhase('subscription_id'); + const responsePromise = client.subscriptions.triggerPhase('subscription_id', {}); const rawResponse = await responsePromise.asResponse(); expect(rawResponse).toBeInstanceOf(Response); const response = await responsePromise; @@ -1272,24 +629,6 @@ describe('resource subscriptions', () => { expect(dataAndResponse.response).toBe(rawResponse); }); - test('triggerPhase: request options instead of params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.triggerPhase('subscription_id', { path: '/_stainless_unknown_path' }), - ).rejects.toThrow(Orb.NotFoundError); - }); - - test('triggerPhase: request options and params are passed correctly', async () => { - // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error - await expect( - client.subscriptions.triggerPhase( - 'subscription_id', - { effective_date: '2019-12-27' }, - { path: '/_stainless_unknown_path' }, - ), - ).rejects.toThrow(Orb.NotFoundError); - }); - test('unscheduleCancellation', async () => { const responsePromise = client.subscriptions.unscheduleCancellation('subscription_id'); const rawResponse = await responsePromise.asResponse();