From f35d0174dde2d2e900d2c088eaca0dd74b25dcf7 Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Tue, 29 Oct 2024 22:09:05 +0000 Subject: [PATCH] feat(api): api update --- .stats.yml | 2 +- README.md | 4 +- package.json | 2 +- src/index.ts | 163 +++-- src/resources/alerts.ts | 12 +- src/resources/coupons/coupons.ts | 8 +- src/resources/coupons/index.ts | 4 +- src/resources/coupons/subscriptions.ts | 2 +- src/resources/credit-notes.ts | 4 +- .../customers/balance-transactions.ts | 8 +- src/resources/customers/costs.ts | 8 +- src/resources/customers/credits/credits.ts | 40 +- src/resources/customers/credits/index.ts | 40 +- src/resources/customers/credits/ledger.ts | 16 +- src/resources/customers/credits/top-ups.ts | 16 +- src/resources/customers/customers.ts | 56 +- src/resources/customers/index.ts | 34 +- src/resources/events/backfills.ts | 14 +- src/resources/events/events.ts | 32 +- src/resources/events/index.ts | 30 +- src/resources/events/volume.ts | 31 +- src/resources/index.ts | 156 ++-- src/resources/invoice-line-items.ts | 4 +- src/resources/invoices.ts | 39 +- src/resources/items.ts | 19 +- src/resources/metrics.ts | 19 +- src/resources/plans/external-plan-id.ts | 14 +- src/resources/plans/index.ts | 11 +- src/resources/plans/plans.ts | 21 +- src/resources/prices/external-price-id.ts | 14 +- src/resources/prices/index.ts | 16 +- src/resources/prices/prices.ts | 27 +- src/resources/subscriptions.ts | 81 +-- src/resources/top-level.ts | 2 +- .../api-resources/customers/customers.test.ts | 124 +--- tests/api-resources/events/volume.test.ts | 31 +- tests/api-resources/invoices.test.ts | 41 +- tests/api-resources/items.test.ts | 27 +- tests/api-resources/metrics.test.ts | 20 +- .../plans/external-plan-id.test.ts | 20 +- tests/api-resources/plans/plans.test.ts | 20 +- .../prices/external-price-id.test.ts | 20 +- tests/api-resources/prices/prices.test.ts | 16 +- tests/api-resources/subscriptions.test.ts | 669 +----------------- tsconfig.json | 3 +- 45 files changed, 419 insertions(+), 1521 deletions(-) diff --git a/.stats.yml b/.stats.yml index 95634a7b..2058bd1c 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-96918acc38b19b3897bf9e90efacbe214997b801f29f00fa246521c8a48f7cc0.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/orb%2Forb-1a0cb9f84cf6b6342b82c87ecdcba968405aac1dfb0c78eaf055a44fe15cab2c.yml diff --git a/README.md b/README.md index 640c17f1..0b592370 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..c5591224 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "packageManager": "yarn@1.22.22", "files": [ - "*" + "**/*" ], "private": false, "scripts": { diff --git a/src/index.ts b/src/index.ts index 2c3a771a..fbdcbf91 100644 --- a/src/index.ts +++ b/src/index.ts @@ -230,127 +230,126 @@ export import toFile = Uploads.toFile; export import fileFromPath = Uploads.fileFromPath; export namespace Orb { - export type RequestOptions = Core.RequestOptions; + export import RequestOptions = Core.RequestOptions; export import Page = Pagination.Page; - export type PageParams = Pagination.PageParams; - export type PageResponse = Pagination.PageResponse; + export import PageParams = Pagination.PageParams; + export import PageResponse = Pagination.PageResponse; export import TopLevel = API.TopLevel; - export type TopLevelPingResponse = API.TopLevelPingResponse; + export import TopLevelPingResponse = API.TopLevelPingResponse; export import Coupons = API.Coupons; - export type Coupon = API.Coupon; + export import Coupon = API.Coupon; export import CouponsPage = API.CouponsPage; - export type CouponCreateParams = API.CouponCreateParams; - export type CouponListParams = API.CouponListParams; + export import CouponCreateParams = API.CouponCreateParams; + export import CouponListParams = API.CouponListParams; export import CreditNotes = API.CreditNotes; - export type CreditNote = API.CreditNote; + export import CreditNote = API.CreditNote; export import CreditNotesPage = API.CreditNotesPage; - export type CreditNoteListParams = API.CreditNoteListParams; + export import CreditNoteListParams = API.CreditNoteListParams; export import Customers = API.Customers; - export type Customer = API.Customer; + export import Customer = API.Customer; export import CustomersPage = API.CustomersPage; - export type CustomerCreateParams = API.CustomerCreateParams; - export type CustomerUpdateParams = API.CustomerUpdateParams; - export type CustomerListParams = API.CustomerListParams; - export type CustomerUpdateByExternalIDParams = API.CustomerUpdateByExternalIDParams; + export import CustomerCreateParams = API.CustomerCreateParams; + export import CustomerUpdateParams = API.CustomerUpdateParams; + export import CustomerListParams = API.CustomerListParams; + export import CustomerUpdateByExternalIDParams = API.CustomerUpdateByExternalIDParams; export import Events = API.Events; - export type EventUpdateResponse = API.EventUpdateResponse; - export type EventDeprecateResponse = API.EventDeprecateResponse; - export type EventIngestResponse = API.EventIngestResponse; - export type EventSearchResponse = API.EventSearchResponse; - export type EventUpdateParams = API.EventUpdateParams; - export type EventIngestParams = API.EventIngestParams; - export type EventSearchParams = API.EventSearchParams; + export import EventUpdateResponse = API.EventUpdateResponse; + export import EventDeprecateResponse = API.EventDeprecateResponse; + export import EventIngestResponse = API.EventIngestResponse; + export import EventSearchResponse = API.EventSearchResponse; + export import EventUpdateParams = API.EventUpdateParams; + export import EventIngestParams = API.EventIngestParams; + export import EventSearchParams = API.EventSearchParams; export import InvoiceLineItems = API.InvoiceLineItems; - export type InvoiceLineItemCreateResponse = API.InvoiceLineItemCreateResponse; - export type InvoiceLineItemCreateParams = API.InvoiceLineItemCreateParams; + export import InvoiceLineItemCreateResponse = API.InvoiceLineItemCreateResponse; + export import InvoiceLineItemCreateParams = API.InvoiceLineItemCreateParams; export import Invoices = API.Invoices; - export type Invoice = API.Invoice; - export type InvoiceFetchUpcomingResponse = API.InvoiceFetchUpcomingResponse; + export import Invoice = API.Invoice; + export import InvoiceFetchUpcomingResponse = API.InvoiceFetchUpcomingResponse; export import InvoicesPage = API.InvoicesPage; - export type InvoiceCreateParams = API.InvoiceCreateParams; - export type InvoiceUpdateParams = API.InvoiceUpdateParams; - export type InvoiceListParams = API.InvoiceListParams; - export type InvoiceFetchUpcomingParams = API.InvoiceFetchUpcomingParams; - export type InvoiceIssueParams = API.InvoiceIssueParams; - export type InvoiceMarkPaidParams = API.InvoiceMarkPaidParams; + export import InvoiceCreateParams = API.InvoiceCreateParams; + export import InvoiceUpdateParams = API.InvoiceUpdateParams; + export import InvoiceListParams = API.InvoiceListParams; + export import InvoiceFetchUpcomingParams = API.InvoiceFetchUpcomingParams; + export import InvoiceIssueParams = API.InvoiceIssueParams; + export import InvoiceMarkPaidParams = API.InvoiceMarkPaidParams; export import Items = API.Items; - export type Item = API.Item; + export import Item = API.Item; export import ItemsPage = API.ItemsPage; - export type ItemCreateParams = API.ItemCreateParams; - export type ItemUpdateParams = API.ItemUpdateParams; - export type ItemListParams = API.ItemListParams; + export import ItemCreateParams = API.ItemCreateParams; + export import ItemUpdateParams = API.ItemUpdateParams; + export import ItemListParams = API.ItemListParams; export import Metrics = API.Metrics; - export type BillableMetric = API.BillableMetric; + export import BillableMetric = API.BillableMetric; export import BillableMetricsPage = API.BillableMetricsPage; - export type MetricCreateParams = API.MetricCreateParams; - export type MetricUpdateParams = API.MetricUpdateParams; - export type MetricListParams = API.MetricListParams; + export import MetricCreateParams = API.MetricCreateParams; + export import MetricUpdateParams = API.MetricUpdateParams; + export import MetricListParams = API.MetricListParams; export import Plans = API.Plans; - export type Plan = API.Plan; + export import Plan = API.Plan; export import PlansPage = API.PlansPage; - export type PlanCreateParams = API.PlanCreateParams; - export type PlanUpdateParams = API.PlanUpdateParams; - export type PlanListParams = API.PlanListParams; + export import PlanCreateParams = API.PlanCreateParams; + export import PlanUpdateParams = API.PlanUpdateParams; + export import PlanListParams = API.PlanListParams; export import Prices = API.Prices; - export type EvaluatePriceGroup = API.EvaluatePriceGroup; - export type Price = API.Price; - export type PriceEvaluateResponse = API.PriceEvaluateResponse; + export import EvaluatePriceGroup = API.EvaluatePriceGroup; + export import Price = API.Price; + export import PriceEvaluateResponse = API.PriceEvaluateResponse; export import PricesPage = API.PricesPage; - export type PriceCreateParams = API.PriceCreateParams; - export type PriceUpdateParams = API.PriceUpdateParams; - export type PriceListParams = API.PriceListParams; - export type PriceEvaluateParams = API.PriceEvaluateParams; + export import PriceCreateParams = API.PriceCreateParams; + export import PriceUpdateParams = API.PriceUpdateParams; + export import PriceListParams = API.PriceListParams; + export import PriceEvaluateParams = API.PriceEvaluateParams; export import Subscriptions = API.Subscriptions; - export type Subscription = API.Subscription; - export type SubscriptionUsage = API.SubscriptionUsage; - export type SubscriptionFetchCostsResponse = API.SubscriptionFetchCostsResponse; - export type SubscriptionFetchScheduleResponse = API.SubscriptionFetchScheduleResponse; + export import Subscription = API.Subscription; + export import SubscriptionUsage = API.SubscriptionUsage; + export import SubscriptionFetchCostsResponse = API.SubscriptionFetchCostsResponse; + export import SubscriptionFetchScheduleResponse = API.SubscriptionFetchScheduleResponse; export import SubscriptionsPage = API.SubscriptionsPage; export import SubscriptionFetchScheduleResponsesPage = API.SubscriptionFetchScheduleResponsesPage; - export type SubscriptionCreateParams = API.SubscriptionCreateParams; - export type SubscriptionUpdateParams = API.SubscriptionUpdateParams; - export type SubscriptionListParams = API.SubscriptionListParams; - export type SubscriptionCancelParams = API.SubscriptionCancelParams; - export type SubscriptionFetchCostsParams = API.SubscriptionFetchCostsParams; - export type SubscriptionFetchScheduleParams = API.SubscriptionFetchScheduleParams; - export type SubscriptionFetchUsageParams = API.SubscriptionFetchUsageParams; - export type SubscriptionPriceIntervalsParams = API.SubscriptionPriceIntervalsParams; - export type SubscriptionSchedulePlanChangeParams = API.SubscriptionSchedulePlanChangeParams; - export type SubscriptionTriggerPhaseParams = API.SubscriptionTriggerPhaseParams; - export type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = - API.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams; - export type SubscriptionUpdateFixedFeeQuantityParams = API.SubscriptionUpdateFixedFeeQuantityParams; - export type SubscriptionUpdateTrialParams = API.SubscriptionUpdateTrialParams; + export import SubscriptionCreateParams = API.SubscriptionCreateParams; + export import SubscriptionUpdateParams = API.SubscriptionUpdateParams; + export import SubscriptionListParams = API.SubscriptionListParams; + export import SubscriptionCancelParams = API.SubscriptionCancelParams; + export import SubscriptionFetchCostsParams = API.SubscriptionFetchCostsParams; + export import SubscriptionFetchScheduleParams = API.SubscriptionFetchScheduleParams; + export import SubscriptionFetchUsageParams = API.SubscriptionFetchUsageParams; + export import SubscriptionPriceIntervalsParams = API.SubscriptionPriceIntervalsParams; + export import SubscriptionSchedulePlanChangeParams = API.SubscriptionSchedulePlanChangeParams; + export import SubscriptionTriggerPhaseParams = API.SubscriptionTriggerPhaseParams; + export import SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = API.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams; + export import SubscriptionUpdateFixedFeeQuantityParams = API.SubscriptionUpdateFixedFeeQuantityParams; + export import SubscriptionUpdateTrialParams = API.SubscriptionUpdateTrialParams; export import Alerts = API.Alerts; - export type Alert = API.Alert; + export import Alert = API.Alert; export import AlertsPage = API.AlertsPage; - export type AlertUpdateParams = API.AlertUpdateParams; - export type AlertListParams = API.AlertListParams; - export type AlertCreateForCustomerParams = API.AlertCreateForCustomerParams; - export type AlertCreateForExternalCustomerParams = API.AlertCreateForExternalCustomerParams; - export type AlertCreateForSubscriptionParams = API.AlertCreateForSubscriptionParams; - - export type AmountDiscount = API.AmountDiscount; - export type BillingCycleRelativeDate = API.BillingCycleRelativeDate; - export type Discount = API.Discount; - export type InvoiceLevelDiscount = API.InvoiceLevelDiscount; - export type PaginationMetadata = API.PaginationMetadata; - export type PercentageDiscount = API.PercentageDiscount; - export type TrialDiscount = API.TrialDiscount; + export import AlertUpdateParams = API.AlertUpdateParams; + export import AlertListParams = API.AlertListParams; + export import AlertCreateForCustomerParams = API.AlertCreateForCustomerParams; + export import AlertCreateForExternalCustomerParams = API.AlertCreateForExternalCustomerParams; + export import AlertCreateForSubscriptionParams = API.AlertCreateForSubscriptionParams; + + export import AmountDiscount = API.AmountDiscount; + export import BillingCycleRelativeDate = API.BillingCycleRelativeDate; + export import Discount = API.Discount; + export import InvoiceLevelDiscount = API.InvoiceLevelDiscount; + export import PaginationMetadata = API.PaginationMetadata; + export import PercentageDiscount = API.PercentageDiscount; + export import TrialDiscount = API.TrialDiscount; } export default Orb; diff --git a/src/resources/alerts.ts b/src/resources/alerts.ts index a4d97cf8..06142618 100644 --- a/src/resources/alerts.ts +++ b/src/resources/alerts.ts @@ -371,11 +371,11 @@ export namespace AlertCreateForSubscriptionParams { } export namespace Alerts { - export type Alert = AlertsAPI.Alert; + export import Alert = AlertsAPI.Alert; export import AlertsPage = AlertsAPI.AlertsPage; - export type AlertUpdateParams = AlertsAPI.AlertUpdateParams; - export type AlertListParams = AlertsAPI.AlertListParams; - export type AlertCreateForCustomerParams = AlertsAPI.AlertCreateForCustomerParams; - export type AlertCreateForExternalCustomerParams = AlertsAPI.AlertCreateForExternalCustomerParams; - export type AlertCreateForSubscriptionParams = AlertsAPI.AlertCreateForSubscriptionParams; + export import AlertUpdateParams = AlertsAPI.AlertUpdateParams; + export import AlertListParams = AlertsAPI.AlertListParams; + export import AlertCreateForCustomerParams = AlertsAPI.AlertCreateForCustomerParams; + export import AlertCreateForExternalCustomerParams = AlertsAPI.AlertCreateForExternalCustomerParams; + export import AlertCreateForSubscriptionParams = AlertsAPI.AlertCreateForSubscriptionParams; } diff --git a/src/resources/coupons/coupons.ts b/src/resources/coupons/coupons.ts index 63312365..9010ef0a 100644 --- a/src/resources/coupons/coupons.ts +++ b/src/resources/coupons/coupons.ts @@ -187,10 +187,10 @@ export interface CouponListParams extends PageParams { } export namespace Coupons { - export type Coupon = CouponsAPI.Coupon; + export import Coupon = CouponsAPI.Coupon; export import CouponsPage = CouponsAPI.CouponsPage; - export type CouponCreateParams = CouponsAPI.CouponCreateParams; - export type CouponListParams = CouponsAPI.CouponListParams; + export import CouponCreateParams = CouponsAPI.CouponCreateParams; + export import CouponListParams = CouponsAPI.CouponListParams; export import Subscriptions = SubscriptionsAPI.Subscriptions; - export type SubscriptionListParams = SubscriptionsAPI.SubscriptionListParams; + export import SubscriptionListParams = SubscriptionsAPI.SubscriptionListParams; } diff --git a/src/resources/coupons/index.ts b/src/resources/coupons/index.ts index 9c93d769..5933e199 100644 --- a/src/resources/coupons/index.ts +++ b/src/resources/coupons/index.ts @@ -1,4 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { CouponsPage, Coupons, type Coupon, type CouponCreateParams, type CouponListParams } from './coupons'; -export { Subscriptions, type SubscriptionListParams } from './subscriptions'; +export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons'; +export { SubscriptionListParams, Subscriptions } from './subscriptions'; diff --git a/src/resources/coupons/subscriptions.ts b/src/resources/coupons/subscriptions.ts index ec642d77..048913c1 100644 --- a/src/resources/coupons/subscriptions.ts +++ b/src/resources/coupons/subscriptions.ts @@ -42,7 +42,7 @@ export class Subscriptions extends APIResource { export interface SubscriptionListParams extends PageParams {} export namespace Subscriptions { - export type SubscriptionListParams = CouponsSubscriptionsAPI.SubscriptionListParams; + export import SubscriptionListParams = CouponsSubscriptionsAPI.SubscriptionListParams; } export { SubscriptionsPage }; diff --git a/src/resources/credit-notes.ts b/src/resources/credit-notes.ts index 56d80994..e2c55643 100644 --- a/src/resources/credit-notes.ts +++ b/src/resources/credit-notes.ts @@ -241,7 +241,7 @@ export namespace CreditNote { export interface CreditNoteListParams extends PageParams {} export namespace CreditNotes { - export type CreditNote = CreditNotesAPI.CreditNote; + export import CreditNote = CreditNotesAPI.CreditNote; export import CreditNotesPage = CreditNotesAPI.CreditNotesPage; - export type CreditNoteListParams = CreditNotesAPI.CreditNoteListParams; + export import CreditNoteListParams = CreditNotesAPI.CreditNoteListParams; } diff --git a/src/resources/customers/balance-transactions.ts b/src/resources/customers/balance-transactions.ts index 4fe317a9..cd8acc1e 100644 --- a/src/resources/customers/balance-transactions.ts +++ b/src/resources/customers/balance-transactions.ts @@ -230,9 +230,9 @@ export interface BalanceTransactionListParams extends PageParams { } export namespace BalanceTransactions { - export type BalanceTransactionCreateResponse = BalanceTransactionsAPI.BalanceTransactionCreateResponse; - export type BalanceTransactionListResponse = BalanceTransactionsAPI.BalanceTransactionListResponse; + export import BalanceTransactionCreateResponse = BalanceTransactionsAPI.BalanceTransactionCreateResponse; + export import BalanceTransactionListResponse = BalanceTransactionsAPI.BalanceTransactionListResponse; export import BalanceTransactionListResponsesPage = BalanceTransactionsAPI.BalanceTransactionListResponsesPage; - export type BalanceTransactionCreateParams = BalanceTransactionsAPI.BalanceTransactionCreateParams; - export type BalanceTransactionListParams = BalanceTransactionsAPI.BalanceTransactionListParams; + export import BalanceTransactionCreateParams = BalanceTransactionsAPI.BalanceTransactionCreateParams; + export import BalanceTransactionListParams = BalanceTransactionsAPI.BalanceTransactionListParams; } diff --git a/src/resources/customers/costs.ts b/src/resources/customers/costs.ts index dcbdb4fa..945eb503 100644 --- a/src/resources/customers/costs.ts +++ b/src/resources/customers/costs.ts @@ -893,8 +893,8 @@ export interface CostListByExternalIDParams { } export namespace Costs { - export type CostListResponse = CostsAPI.CostListResponse; - export type CostListByExternalIDResponse = CostsAPI.CostListByExternalIDResponse; - export type CostListParams = CostsAPI.CostListParams; - export type CostListByExternalIDParams = CostsAPI.CostListByExternalIDParams; + export import CostListResponse = CostsAPI.CostListResponse; + export import CostListByExternalIDResponse = CostsAPI.CostListByExternalIDResponse; + export import CostListParams = CostsAPI.CostListParams; + export import CostListByExternalIDParams = CostsAPI.CostListByExternalIDParams; } diff --git a/src/resources/customers/credits/credits.ts b/src/resources/customers/credits/credits.ts index 3a9c2f83..469a997f 100644 --- a/src/resources/customers/credits/credits.ts +++ b/src/resources/customers/credits/credits.ts @@ -133,32 +133,32 @@ export interface CreditListByExternalIDParams extends PageParams { } export namespace Credits { - export type CreditListResponse = CreditsAPI.CreditListResponse; - export type CreditListByExternalIDResponse = CreditsAPI.CreditListByExternalIDResponse; + export import CreditListResponse = CreditsAPI.CreditListResponse; + export import CreditListByExternalIDResponse = CreditsAPI.CreditListByExternalIDResponse; export import CreditListResponsesPage = CreditsAPI.CreditListResponsesPage; export import CreditListByExternalIDResponsesPage = CreditsAPI.CreditListByExternalIDResponsesPage; - export type CreditListParams = CreditsAPI.CreditListParams; - export type CreditListByExternalIDParams = CreditsAPI.CreditListByExternalIDParams; + export import CreditListParams = CreditsAPI.CreditListParams; + export import CreditListByExternalIDParams = CreditsAPI.CreditListByExternalIDParams; export import Ledger = LedgerAPI.Ledger; - export type LedgerListResponse = LedgerAPI.LedgerListResponse; - export type LedgerCreateEntryResponse = LedgerAPI.LedgerCreateEntryResponse; - export type LedgerCreateEntryByExternalIDResponse = LedgerAPI.LedgerCreateEntryByExternalIDResponse; - export type LedgerListByExternalIDResponse = LedgerAPI.LedgerListByExternalIDResponse; + export import LedgerListResponse = LedgerAPI.LedgerListResponse; + export import LedgerCreateEntryResponse = LedgerAPI.LedgerCreateEntryResponse; + export import LedgerCreateEntryByExternalIDResponse = LedgerAPI.LedgerCreateEntryByExternalIDResponse; + export import LedgerListByExternalIDResponse = LedgerAPI.LedgerListByExternalIDResponse; export import LedgerListResponsesPage = LedgerAPI.LedgerListResponsesPage; export import LedgerListByExternalIDResponsesPage = LedgerAPI.LedgerListByExternalIDResponsesPage; - export type LedgerListParams = LedgerAPI.LedgerListParams; - export type LedgerCreateEntryParams = LedgerAPI.LedgerCreateEntryParams; - export type LedgerCreateEntryByExternalIDParams = LedgerAPI.LedgerCreateEntryByExternalIDParams; - export type LedgerListByExternalIDParams = LedgerAPI.LedgerListByExternalIDParams; + export import LedgerListParams = LedgerAPI.LedgerListParams; + export import LedgerCreateEntryParams = LedgerAPI.LedgerCreateEntryParams; + export import LedgerCreateEntryByExternalIDParams = LedgerAPI.LedgerCreateEntryByExternalIDParams; + export import LedgerListByExternalIDParams = LedgerAPI.LedgerListByExternalIDParams; export import TopUps = TopUpsAPI.TopUps; - export type TopUpCreateResponse = TopUpsAPI.TopUpCreateResponse; - export type TopUpListResponse = TopUpsAPI.TopUpListResponse; - export type TopUpCreateByExternalIDResponse = TopUpsAPI.TopUpCreateByExternalIDResponse; - export type TopUpListByExternalIDResponse = TopUpsAPI.TopUpListByExternalIDResponse; + export import TopUpCreateResponse = TopUpsAPI.TopUpCreateResponse; + export import TopUpListResponse = TopUpsAPI.TopUpListResponse; + export import TopUpCreateByExternalIDResponse = TopUpsAPI.TopUpCreateByExternalIDResponse; + export import TopUpListByExternalIDResponse = TopUpsAPI.TopUpListByExternalIDResponse; export import TopUpListResponsesPage = TopUpsAPI.TopUpListResponsesPage; export import TopUpListByExternalIDResponsesPage = TopUpsAPI.TopUpListByExternalIDResponsesPage; - export type TopUpCreateParams = TopUpsAPI.TopUpCreateParams; - export type TopUpListParams = TopUpsAPI.TopUpListParams; - export type TopUpCreateByExternalIDParams = TopUpsAPI.TopUpCreateByExternalIDParams; - export type TopUpListByExternalIDParams = TopUpsAPI.TopUpListByExternalIDParams; + export import TopUpCreateParams = TopUpsAPI.TopUpCreateParams; + export import TopUpListParams = TopUpsAPI.TopUpListParams; + export import TopUpCreateByExternalIDParams = TopUpsAPI.TopUpCreateByExternalIDParams; + export import TopUpListByExternalIDParams = TopUpsAPI.TopUpListByExternalIDParams; } diff --git a/src/resources/customers/credits/index.ts b/src/resources/customers/credits/index.ts index db8403ee..86350562 100644 --- a/src/resources/customers/credits/index.ts +++ b/src/resources/customers/credits/index.ts @@ -1,37 +1,37 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + CreditListResponse, + CreditListByExternalIDResponse, + CreditListParams, + CreditListByExternalIDParams, CreditListResponsesPage, CreditListByExternalIDResponsesPage, Credits, - type CreditListResponse, - type CreditListByExternalIDResponse, - type CreditListParams, - type CreditListByExternalIDParams, } from './credits'; export { + LedgerListResponse, + LedgerCreateEntryResponse, + LedgerCreateEntryByExternalIDResponse, + LedgerListByExternalIDResponse, + LedgerListParams, + LedgerCreateEntryParams, + LedgerCreateEntryByExternalIDParams, + LedgerListByExternalIDParams, LedgerListResponsesPage, LedgerListByExternalIDResponsesPage, Ledger, - type LedgerListResponse, - type LedgerCreateEntryResponse, - type LedgerCreateEntryByExternalIDResponse, - type LedgerListByExternalIDResponse, - type LedgerListParams, - type LedgerCreateEntryParams, - type LedgerCreateEntryByExternalIDParams, - type LedgerListByExternalIDParams, } from './ledger'; export { + TopUpCreateResponse, + TopUpListResponse, + TopUpCreateByExternalIDResponse, + TopUpListByExternalIDResponse, + TopUpCreateParams, + TopUpListParams, + TopUpCreateByExternalIDParams, + TopUpListByExternalIDParams, TopUpListResponsesPage, TopUpListByExternalIDResponsesPage, TopUps, - type TopUpCreateResponse, - type TopUpListResponse, - type TopUpCreateByExternalIDResponse, - type TopUpListByExternalIDResponse, - type TopUpCreateParams, - type TopUpListParams, - type TopUpCreateByExternalIDParams, - type TopUpListByExternalIDParams, } from './top-ups'; diff --git a/src/resources/customers/credits/ledger.ts b/src/resources/customers/credits/ledger.ts index 10836154..39bd377c 100644 --- a/src/resources/customers/credits/ledger.ts +++ b/src/resources/customers/credits/ledger.ts @@ -2559,14 +2559,14 @@ export interface LedgerListByExternalIDParams extends PageParams { } export namespace Ledger { - export type LedgerListResponse = LedgerAPI.LedgerListResponse; - export type LedgerCreateEntryResponse = LedgerAPI.LedgerCreateEntryResponse; - export type LedgerCreateEntryByExternalIDResponse = LedgerAPI.LedgerCreateEntryByExternalIDResponse; - export type LedgerListByExternalIDResponse = LedgerAPI.LedgerListByExternalIDResponse; + export import LedgerListResponse = LedgerAPI.LedgerListResponse; + export import LedgerCreateEntryResponse = LedgerAPI.LedgerCreateEntryResponse; + export import LedgerCreateEntryByExternalIDResponse = LedgerAPI.LedgerCreateEntryByExternalIDResponse; + export import LedgerListByExternalIDResponse = LedgerAPI.LedgerListByExternalIDResponse; export import LedgerListResponsesPage = LedgerAPI.LedgerListResponsesPage; export import LedgerListByExternalIDResponsesPage = LedgerAPI.LedgerListByExternalIDResponsesPage; - export type LedgerListParams = LedgerAPI.LedgerListParams; - export type LedgerCreateEntryParams = LedgerAPI.LedgerCreateEntryParams; - export type LedgerCreateEntryByExternalIDParams = LedgerAPI.LedgerCreateEntryByExternalIDParams; - export type LedgerListByExternalIDParams = LedgerAPI.LedgerListByExternalIDParams; + export import LedgerListParams = LedgerAPI.LedgerListParams; + export import LedgerCreateEntryParams = LedgerAPI.LedgerCreateEntryParams; + export import LedgerCreateEntryByExternalIDParams = LedgerAPI.LedgerCreateEntryByExternalIDParams; + export import LedgerListByExternalIDParams = LedgerAPI.LedgerListByExternalIDParams; } diff --git a/src/resources/customers/credits/top-ups.ts b/src/resources/customers/credits/top-ups.ts index a2b23327..080b5c04 100644 --- a/src/resources/customers/credits/top-ups.ts +++ b/src/resources/customers/credits/top-ups.ts @@ -565,14 +565,14 @@ export namespace TopUpCreateByExternalIDParams { export interface TopUpListByExternalIDParams extends PageParams {} export namespace TopUps { - export type TopUpCreateResponse = TopUpsAPI.TopUpCreateResponse; - export type TopUpListResponse = TopUpsAPI.TopUpListResponse; - export type TopUpCreateByExternalIDResponse = TopUpsAPI.TopUpCreateByExternalIDResponse; - export type TopUpListByExternalIDResponse = TopUpsAPI.TopUpListByExternalIDResponse; + export import TopUpCreateResponse = TopUpsAPI.TopUpCreateResponse; + export import TopUpListResponse = TopUpsAPI.TopUpListResponse; + export import TopUpCreateByExternalIDResponse = TopUpsAPI.TopUpCreateByExternalIDResponse; + export import TopUpListByExternalIDResponse = TopUpsAPI.TopUpListByExternalIDResponse; export import TopUpListResponsesPage = TopUpsAPI.TopUpListResponsesPage; export import TopUpListByExternalIDResponsesPage = TopUpsAPI.TopUpListByExternalIDResponsesPage; - export type TopUpCreateParams = TopUpsAPI.TopUpCreateParams; - export type TopUpListParams = TopUpsAPI.TopUpListParams; - export type TopUpCreateByExternalIDParams = TopUpsAPI.TopUpCreateByExternalIDParams; - export type TopUpListByExternalIDParams = TopUpsAPI.TopUpListByExternalIDParams; + export import TopUpCreateParams = TopUpsAPI.TopUpCreateParams; + export import TopUpListParams = TopUpsAPI.TopUpListParams; + export import TopUpCreateByExternalIDParams = TopUpsAPI.TopUpCreateByExternalIDParams; + export import TopUpListByExternalIDParams = TopUpsAPI.TopUpListByExternalIDParams; } diff --git a/src/resources/customers/customers.ts b/src/resources/customers/customers.ts index cdf2e32a..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 }); } } @@ -2219,28 +2201,28 @@ export namespace CustomerUpdateByExternalIDParams { } export namespace Customers { - export type Customer = CustomersAPI.Customer; + export import Customer = CustomersAPI.Customer; export import CustomersPage = CustomersAPI.CustomersPage; - export type CustomerCreateParams = CustomersAPI.CustomerCreateParams; - export type CustomerUpdateParams = CustomersAPI.CustomerUpdateParams; - export type CustomerListParams = CustomersAPI.CustomerListParams; - export type CustomerUpdateByExternalIDParams = CustomersAPI.CustomerUpdateByExternalIDParams; + export import CustomerCreateParams = CustomersAPI.CustomerCreateParams; + export import CustomerUpdateParams = CustomersAPI.CustomerUpdateParams; + export import CustomerListParams = CustomersAPI.CustomerListParams; + export import CustomerUpdateByExternalIDParams = CustomersAPI.CustomerUpdateByExternalIDParams; export import Costs = CostsAPI.Costs; - export type CostListResponse = CostsAPI.CostListResponse; - export type CostListByExternalIDResponse = CostsAPI.CostListByExternalIDResponse; - export type CostListParams = CostsAPI.CostListParams; - export type CostListByExternalIDParams = CostsAPI.CostListByExternalIDParams; + export import CostListResponse = CostsAPI.CostListResponse; + export import CostListByExternalIDResponse = CostsAPI.CostListByExternalIDResponse; + export import CostListParams = CostsAPI.CostListParams; + export import CostListByExternalIDParams = CostsAPI.CostListByExternalIDParams; export import Credits = CreditsAPI.Credits; - export type CreditListResponse = CreditsAPI.CreditListResponse; - export type CreditListByExternalIDResponse = CreditsAPI.CreditListByExternalIDResponse; + export import CreditListResponse = CreditsAPI.CreditListResponse; + export import CreditListByExternalIDResponse = CreditsAPI.CreditListByExternalIDResponse; export import CreditListResponsesPage = CreditsAPI.CreditListResponsesPage; export import CreditListByExternalIDResponsesPage = CreditsAPI.CreditListByExternalIDResponsesPage; - export type CreditListParams = CreditsAPI.CreditListParams; - export type CreditListByExternalIDParams = CreditsAPI.CreditListByExternalIDParams; + export import CreditListParams = CreditsAPI.CreditListParams; + export import CreditListByExternalIDParams = CreditsAPI.CreditListByExternalIDParams; export import BalanceTransactions = BalanceTransactionsAPI.BalanceTransactions; - export type BalanceTransactionCreateResponse = BalanceTransactionsAPI.BalanceTransactionCreateResponse; - export type BalanceTransactionListResponse = BalanceTransactionsAPI.BalanceTransactionListResponse; + export import BalanceTransactionCreateResponse = BalanceTransactionsAPI.BalanceTransactionCreateResponse; + export import BalanceTransactionListResponse = BalanceTransactionsAPI.BalanceTransactionListResponse; export import BalanceTransactionListResponsesPage = BalanceTransactionsAPI.BalanceTransactionListResponsesPage; - export type BalanceTransactionCreateParams = BalanceTransactionsAPI.BalanceTransactionCreateParams; - export type BalanceTransactionListParams = BalanceTransactionsAPI.BalanceTransactionListParams; + export import BalanceTransactionCreateParams = BalanceTransactionsAPI.BalanceTransactionCreateParams; + export import BalanceTransactionListParams = BalanceTransactionsAPI.BalanceTransactionListParams; } diff --git a/src/resources/customers/index.ts b/src/resources/customers/index.ts index 123c9dd4..1671d94a 100644 --- a/src/resources/customers/index.ts +++ b/src/resources/customers/index.ts @@ -1,35 +1,35 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + BalanceTransactionCreateResponse, + BalanceTransactionListResponse, + BalanceTransactionCreateParams, + BalanceTransactionListParams, BalanceTransactionListResponsesPage, BalanceTransactions, - type BalanceTransactionCreateResponse, - type BalanceTransactionListResponse, - type BalanceTransactionCreateParams, - type BalanceTransactionListParams, } from './balance-transactions'; export { + CostListResponse, + CostListByExternalIDResponse, + CostListParams, + CostListByExternalIDParams, Costs, - type CostListResponse, - type CostListByExternalIDResponse, - type CostListParams, - type CostListByExternalIDParams, } from './costs'; export { + CreditListResponse, + CreditListByExternalIDResponse, + CreditListParams, + CreditListByExternalIDParams, CreditListResponsesPage, CreditListByExternalIDResponsesPage, Credits, - type CreditListResponse, - type CreditListByExternalIDResponse, - type CreditListParams, - type CreditListByExternalIDParams, } from './credits/index'; export { + Customer, + CustomerCreateParams, + CustomerUpdateParams, + CustomerListParams, + CustomerUpdateByExternalIDParams, CustomersPage, Customers, - type Customer, - type CustomerCreateParams, - type CustomerUpdateParams, - type CustomerListParams, - type CustomerUpdateByExternalIDParams, } from './customers'; diff --git a/src/resources/events/backfills.ts b/src/resources/events/backfills.ts index da1b9110..479b5c3b 100644 --- a/src/resources/events/backfills.ts +++ b/src/resources/events/backfills.ts @@ -392,12 +392,12 @@ export interface BackfillCreateParams { export interface BackfillListParams extends PageParams {} export namespace Backfills { - export type BackfillCreateResponse = BackfillsAPI.BackfillCreateResponse; - export type BackfillListResponse = BackfillsAPI.BackfillListResponse; - export type BackfillCloseResponse = BackfillsAPI.BackfillCloseResponse; - export type BackfillFetchResponse = BackfillsAPI.BackfillFetchResponse; - export type BackfillRevertResponse = BackfillsAPI.BackfillRevertResponse; + export import BackfillCreateResponse = BackfillsAPI.BackfillCreateResponse; + export import BackfillListResponse = BackfillsAPI.BackfillListResponse; + export import BackfillCloseResponse = BackfillsAPI.BackfillCloseResponse; + export import BackfillFetchResponse = BackfillsAPI.BackfillFetchResponse; + export import BackfillRevertResponse = BackfillsAPI.BackfillRevertResponse; export import BackfillListResponsesPage = BackfillsAPI.BackfillListResponsesPage; - export type BackfillCreateParams = BackfillsAPI.BackfillCreateParams; - export type BackfillListParams = BackfillsAPI.BackfillListParams; + export import BackfillCreateParams = BackfillsAPI.BackfillCreateParams; + export import BackfillListParams = BackfillsAPI.BackfillListParams; } diff --git a/src/resources/events/events.ts b/src/resources/events/events.ts index 3ec12dca..5b5f94b1 100644 --- a/src/resources/events/events.ts +++ b/src/resources/events/events.ts @@ -563,23 +563,23 @@ export interface EventSearchParams { } export namespace Events { - export type EventUpdateResponse = EventsAPI.EventUpdateResponse; - export type EventDeprecateResponse = EventsAPI.EventDeprecateResponse; - export type EventIngestResponse = EventsAPI.EventIngestResponse; - export type EventSearchResponse = EventsAPI.EventSearchResponse; - export type EventUpdateParams = EventsAPI.EventUpdateParams; - export type EventIngestParams = EventsAPI.EventIngestParams; - export type EventSearchParams = EventsAPI.EventSearchParams; + export import EventUpdateResponse = EventsAPI.EventUpdateResponse; + export import EventDeprecateResponse = EventsAPI.EventDeprecateResponse; + export import EventIngestResponse = EventsAPI.EventIngestResponse; + export import EventSearchResponse = EventsAPI.EventSearchResponse; + export import EventUpdateParams = EventsAPI.EventUpdateParams; + export import EventIngestParams = EventsAPI.EventIngestParams; + export import EventSearchParams = EventsAPI.EventSearchParams; export import Backfills = BackfillsAPI.Backfills; - export type BackfillCreateResponse = BackfillsAPI.BackfillCreateResponse; - export type BackfillListResponse = BackfillsAPI.BackfillListResponse; - export type BackfillCloseResponse = BackfillsAPI.BackfillCloseResponse; - export type BackfillFetchResponse = BackfillsAPI.BackfillFetchResponse; - export type BackfillRevertResponse = BackfillsAPI.BackfillRevertResponse; + export import BackfillCreateResponse = BackfillsAPI.BackfillCreateResponse; + export import BackfillListResponse = BackfillsAPI.BackfillListResponse; + export import BackfillCloseResponse = BackfillsAPI.BackfillCloseResponse; + export import BackfillFetchResponse = BackfillsAPI.BackfillFetchResponse; + export import BackfillRevertResponse = BackfillsAPI.BackfillRevertResponse; export import BackfillListResponsesPage = BackfillsAPI.BackfillListResponsesPage; - export type BackfillCreateParams = BackfillsAPI.BackfillCreateParams; - export type BackfillListParams = BackfillsAPI.BackfillListParams; + export import BackfillCreateParams = BackfillsAPI.BackfillCreateParams; + export import BackfillListParams = BackfillsAPI.BackfillListParams; export import Volume = VolumeAPI.Volume; - export type EventVolumes = VolumeAPI.EventVolumes; - export type VolumeListParams = VolumeAPI.VolumeListParams; + export import EventVolumes = VolumeAPI.EventVolumes; + export import VolumeListParams = VolumeAPI.VolumeListParams; } diff --git a/src/resources/events/index.ts b/src/resources/events/index.ts index ffb745f6..4e7c3138 100644 --- a/src/resources/events/index.ts +++ b/src/resources/events/index.ts @@ -1,24 +1,24 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. export { + BackfillCreateResponse, + BackfillListResponse, + BackfillCloseResponse, + BackfillFetchResponse, + BackfillRevertResponse, + BackfillCreateParams, + BackfillListParams, BackfillListResponsesPage, Backfills, - type BackfillCreateResponse, - type BackfillListResponse, - type BackfillCloseResponse, - type BackfillFetchResponse, - type BackfillRevertResponse, - type BackfillCreateParams, - type BackfillListParams, } from './backfills'; export { + EventUpdateResponse, + EventDeprecateResponse, + EventIngestResponse, + EventSearchResponse, + EventUpdateParams, + EventIngestParams, + EventSearchParams, Events, - type EventUpdateResponse, - type EventDeprecateResponse, - type EventIngestResponse, - type EventSearchResponse, - type EventUpdateParams, - type EventIngestParams, - type EventSearchParams, } from './events'; -export { Volume, type EventVolumes, type VolumeListParams } from './volume'; +export { EventVolumes, VolumeListParams, Volume } from './volume'; diff --git a/src/resources/events/volume.ts b/src/resources/events/volume.ts index 52977a4a..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,17 +73,9 @@ 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 { - export type EventVolumes = VolumeAPI.EventVolumes; - export type VolumeListParams = VolumeAPI.VolumeListParams; + export import EventVolumes = VolumeAPI.EventVolumes; + export import VolumeListParams = VolumeAPI.VolumeListParams; } diff --git a/src/resources/index.ts b/src/resources/index.ts index e4b6324d..c36858aa 100644 --- a/src/resources/index.ts +++ b/src/resources/index.ts @@ -2,114 +2,94 @@ export * from './shared'; export { + Alert, + AlertUpdateParams, + AlertListParams, + AlertCreateForCustomerParams, + AlertCreateForExternalCustomerParams, + AlertCreateForSubscriptionParams, AlertsPage, Alerts, - type Alert, - type AlertUpdateParams, - type AlertListParams, - type AlertCreateForCustomerParams, - type AlertCreateForExternalCustomerParams, - type AlertCreateForSubscriptionParams, } from './alerts'; export { + BillableMetric, + MetricCreateParams, + MetricUpdateParams, + MetricListParams, BillableMetricsPage, Metrics, - type BillableMetric, - type MetricCreateParams, - type MetricUpdateParams, - type MetricListParams, } from './metrics'; +export { Coupon, CouponCreateParams, CouponListParams, CouponsPage, Coupons } from './coupons/coupons'; +export { CreditNote, CreditNoteListParams, CreditNotesPage, CreditNotes } from './credit-notes'; export { - CouponsPage, - Coupons, - type Coupon, - type CouponCreateParams, - type CouponListParams, -} from './coupons/coupons'; -export { CreditNotesPage, CreditNotes, type CreditNote, type CreditNoteListParams } from './credit-notes'; -export { + Customer, + CustomerCreateParams, + CustomerUpdateParams, + CustomerListParams, + CustomerUpdateByExternalIDParams, CustomersPage, Customers, - type Customer, - type CustomerCreateParams, - type CustomerUpdateParams, - type CustomerListParams, - type CustomerUpdateByExternalIDParams, } from './customers/customers'; export { + EvaluatePriceGroup, + Price, + PriceEvaluateResponse, + PriceCreateParams, + PriceUpdateParams, + PriceListParams, + PriceEvaluateParams, + PricesPage, + Prices, +} from './prices/prices'; +export { + EventUpdateResponse, + EventDeprecateResponse, + EventIngestResponse, + EventSearchResponse, + EventUpdateParams, + EventIngestParams, + EventSearchParams, Events, - type EventUpdateResponse, - type EventDeprecateResponse, - type EventIngestResponse, - type EventSearchResponse, - type EventUpdateParams, - type EventIngestParams, - type EventSearchParams, } from './events/events'; export { - InvoiceLineItems, - type InvoiceLineItemCreateResponse, - type InvoiceLineItemCreateParams, -} from './invoice-line-items'; -export { + Invoice, + InvoiceFetchUpcomingResponse, + InvoiceCreateParams, + InvoiceUpdateParams, + InvoiceListParams, + InvoiceFetchUpcomingParams, + InvoiceIssueParams, + InvoiceMarkPaidParams, InvoicesPage, Invoices, - type Invoice, - type InvoiceFetchUpcomingResponse, - type InvoiceCreateParams, - type InvoiceUpdateParams, - type InvoiceListParams, - type InvoiceFetchUpcomingParams, - type InvoiceIssueParams, - type InvoiceMarkPaidParams, } from './invoices'; export { - ItemsPage, - Items, - type Item, - type ItemCreateParams, - type ItemUpdateParams, - type ItemListParams, -} from './items'; -export { - PlansPage, - Plans, - type Plan, - type PlanCreateParams, - type PlanUpdateParams, - type PlanListParams, -} from './plans/plans'; -export { - PricesPage, - Prices, - type EvaluatePriceGroup, - type Price, - type PriceEvaluateResponse, - type PriceCreateParams, - type PriceUpdateParams, - type PriceListParams, - type PriceEvaluateParams, -} from './prices/prices'; + InvoiceLineItemCreateResponse, + InvoiceLineItemCreateParams, + InvoiceLineItems, +} from './invoice-line-items'; +export { Item, ItemCreateParams, ItemUpdateParams, ItemListParams, ItemsPage, Items } from './items'; +export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans/plans'; export { + Subscription, + SubscriptionUsage, + Subscriptions, + SubscriptionFetchCostsResponse, + SubscriptionFetchScheduleResponse, + SubscriptionCreateParams, + SubscriptionUpdateParams, + SubscriptionListParams, + SubscriptionCancelParams, + SubscriptionFetchCostsParams, + SubscriptionFetchScheduleParams, + SubscriptionFetchUsageParams, + SubscriptionPriceIntervalsParams, + SubscriptionSchedulePlanChangeParams, + SubscriptionTriggerPhaseParams, + SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, + SubscriptionUpdateFixedFeeQuantityParams, + SubscriptionUpdateTrialParams, SubscriptionsPage, SubscriptionFetchScheduleResponsesPage, - type Subscriptions, - type Subscription, - type SubscriptionUsage, - type SubscriptionFetchCostsResponse, - type SubscriptionFetchScheduleResponse, - type SubscriptionCreateParams, - type SubscriptionUpdateParams, - type SubscriptionListParams, - type SubscriptionCancelParams, - type SubscriptionFetchCostsParams, - type SubscriptionFetchScheduleParams, - type SubscriptionFetchUsageParams, - type SubscriptionPriceIntervalsParams, - type SubscriptionSchedulePlanChangeParams, - type SubscriptionTriggerPhaseParams, - type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams, - type SubscriptionUpdateFixedFeeQuantityParams, - type SubscriptionUpdateTrialParams, } from './subscriptions'; -export { TopLevel, type TopLevelPingResponse } from './top-level'; +export { TopLevelPingResponse, TopLevel } from './top-level'; diff --git a/src/resources/invoice-line-items.ts b/src/resources/invoice-line-items.ts index 4b9f9667..b1b88649 100644 --- a/src/resources/invoice-line-items.ts +++ b/src/resources/invoice-line-items.ts @@ -497,6 +497,6 @@ export interface InvoiceLineItemCreateParams { } export namespace InvoiceLineItems { - export type InvoiceLineItemCreateResponse = InvoiceLineItemsAPI.InvoiceLineItemCreateResponse; - export type InvoiceLineItemCreateParams = InvoiceLineItemsAPI.InvoiceLineItemCreateParams; + export import InvoiceLineItemCreateResponse = InvoiceLineItemsAPI.InvoiceLineItemCreateResponse; + export import InvoiceLineItemCreateParams = InvoiceLineItemsAPI.InvoiceLineItemCreateParams; } diff --git a/src/resources/invoices.ts b/src/resources/invoices.ts index 1451fceb..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 { @@ -2676,13 +2659,13 @@ export interface InvoiceMarkPaidParams { } export namespace Invoices { - export type Invoice = InvoicesAPI.Invoice; - export type InvoiceFetchUpcomingResponse = InvoicesAPI.InvoiceFetchUpcomingResponse; + export import Invoice = InvoicesAPI.Invoice; + export import InvoiceFetchUpcomingResponse = InvoicesAPI.InvoiceFetchUpcomingResponse; export import InvoicesPage = InvoicesAPI.InvoicesPage; - export type InvoiceCreateParams = InvoicesAPI.InvoiceCreateParams; - export type InvoiceUpdateParams = InvoicesAPI.InvoiceUpdateParams; - export type InvoiceListParams = InvoicesAPI.InvoiceListParams; - export type InvoiceFetchUpcomingParams = InvoicesAPI.InvoiceFetchUpcomingParams; - export type InvoiceIssueParams = InvoicesAPI.InvoiceIssueParams; - export type InvoiceMarkPaidParams = InvoicesAPI.InvoiceMarkPaidParams; + export import InvoiceCreateParams = InvoicesAPI.InvoiceCreateParams; + export import InvoiceUpdateParams = InvoicesAPI.InvoiceUpdateParams; + export import InvoiceListParams = InvoicesAPI.InvoiceListParams; + export import InvoiceFetchUpcomingParams = InvoicesAPI.InvoiceFetchUpcomingParams; + export import InvoiceIssueParams = InvoicesAPI.InvoiceIssueParams; + export import InvoiceMarkPaidParams = InvoicesAPI.InvoiceMarkPaidParams; } diff --git a/src/resources/items.ts b/src/resources/items.ts index 6d8f7a99..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 }); } @@ -117,9 +108,9 @@ export namespace ItemUpdateParams { export interface ItemListParams extends PageParams {} export namespace Items { - export type Item = ItemsAPI.Item; + export import Item = ItemsAPI.Item; export import ItemsPage = ItemsAPI.ItemsPage; - export type ItemCreateParams = ItemsAPI.ItemCreateParams; - export type ItemUpdateParams = ItemsAPI.ItemUpdateParams; - export type ItemListParams = ItemsAPI.ItemListParams; + export import ItemCreateParams = ItemsAPI.ItemCreateParams; + export import ItemUpdateParams = ItemsAPI.ItemUpdateParams; + export import ItemListParams = ItemsAPI.ItemListParams; } diff --git a/src/resources/metrics.ts b/src/resources/metrics.ts index 4a914914..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 }); } @@ -150,9 +141,9 @@ export interface MetricListParams extends PageParams { } export namespace Metrics { - export type BillableMetric = MetricsAPI.BillableMetric; + export import BillableMetric = MetricsAPI.BillableMetric; export import BillableMetricsPage = MetricsAPI.BillableMetricsPage; - export type MetricCreateParams = MetricsAPI.MetricCreateParams; - export type MetricUpdateParams = MetricsAPI.MetricUpdateParams; - export type MetricListParams = MetricsAPI.MetricListParams; + export import MetricCreateParams = MetricsAPI.MetricCreateParams; + export import MetricUpdateParams = MetricsAPI.MetricUpdateParams; + export import MetricListParams = MetricsAPI.MetricListParams; } diff --git a/src/resources/plans/external-plan-id.ts b/src/resources/plans/external-plan-id.ts index e27ff6d0..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 }); } @@ -70,5 +60,5 @@ export interface ExternalPlanIDUpdateParams { } export namespace ExternalPlanID { - export type ExternalPlanIDUpdateParams = ExternalPlanIDAPI.ExternalPlanIDUpdateParams; + export import ExternalPlanIDUpdateParams = ExternalPlanIDAPI.ExternalPlanIDUpdateParams; } diff --git a/src/resources/plans/index.ts b/src/resources/plans/index.ts index b0ef5ba5..a4e530f9 100644 --- a/src/resources/plans/index.ts +++ b/src/resources/plans/index.ts @@ -1,11 +1,4 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ExternalPlanID, type ExternalPlanIDUpdateParams } from './external-plan-id'; -export { - PlansPage, - Plans, - type Plan, - type PlanCreateParams, - type PlanUpdateParams, - type PlanListParams, -} from './plans'; +export { ExternalPlanIDUpdateParams, ExternalPlanID } from './external-plan-id'; +export { Plan, PlanCreateParams, PlanUpdateParams, PlanListParams, PlansPage, Plans } from './plans'; diff --git a/src/resources/plans/plans.ts b/src/resources/plans/plans.ts index 20fe39a7..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 }); } @@ -2704,11 +2695,11 @@ export interface PlanListParams extends PageParams { } export namespace Plans { - export type Plan = PlansAPI.Plan; + export import Plan = PlansAPI.Plan; export import PlansPage = PlansAPI.PlansPage; - export type PlanCreateParams = PlansAPI.PlanCreateParams; - export type PlanUpdateParams = PlansAPI.PlanUpdateParams; - export type PlanListParams = PlansAPI.PlanListParams; + export import PlanCreateParams = PlansAPI.PlanCreateParams; + export import PlanUpdateParams = PlansAPI.PlanUpdateParams; + export import PlanListParams = PlansAPI.PlanListParams; export import ExternalPlanID = ExternalPlanIDAPI.ExternalPlanID; - export type ExternalPlanIDUpdateParams = ExternalPlanIDAPI.ExternalPlanIDUpdateParams; + export import ExternalPlanIDUpdateParams = ExternalPlanIDAPI.ExternalPlanIDUpdateParams; } diff --git a/src/resources/prices/external-price-id.ts b/src/resources/prices/external-price-id.ts index 8a01c90c..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 }); } @@ -49,5 +39,5 @@ export interface ExternalPriceIDUpdateParams { } export namespace ExternalPriceID { - export type ExternalPriceIDUpdateParams = ExternalPriceIDAPI.ExternalPriceIDUpdateParams; + export import ExternalPriceIDUpdateParams = ExternalPriceIDAPI.ExternalPriceIDUpdateParams; } diff --git a/src/resources/prices/index.ts b/src/resources/prices/index.ts index bba41937..bb08911a 100644 --- a/src/resources/prices/index.ts +++ b/src/resources/prices/index.ts @@ -1,14 +1,14 @@ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -export { ExternalPriceID, type ExternalPriceIDUpdateParams } from './external-price-id'; export { + EvaluatePriceGroup, + Price, + PriceEvaluateResponse, + PriceCreateParams, + PriceUpdateParams, + PriceListParams, + PriceEvaluateParams, PricesPage, Prices, - type EvaluatePriceGroup, - type Price, - type PriceEvaluateResponse, - type PriceCreateParams, - type PriceUpdateParams, - type PriceListParams, - type PriceEvaluateParams, } from './prices'; +export { ExternalPriceIDUpdateParams, ExternalPriceID } from './external-price-id'; diff --git a/src/resources/prices/prices.ts b/src/resources/prices/prices.ts index 306a16d8..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 }); } @@ -5758,14 +5749,14 @@ export interface PriceEvaluateParams { } export namespace Prices { - export type EvaluatePriceGroup = PricesAPI.EvaluatePriceGroup; - export type Price = PricesAPI.Price; - export type PriceEvaluateResponse = PricesAPI.PriceEvaluateResponse; + export import EvaluatePriceGroup = PricesAPI.EvaluatePriceGroup; + export import Price = PricesAPI.Price; + export import PriceEvaluateResponse = PricesAPI.PriceEvaluateResponse; export import PricesPage = PricesAPI.PricesPage; - export type PriceCreateParams = PricesAPI.PriceCreateParams; - export type PriceUpdateParams = PricesAPI.PriceUpdateParams; - export type PriceListParams = PricesAPI.PriceListParams; - export type PriceEvaluateParams = PricesAPI.PriceEvaluateParams; + export import PriceCreateParams = PricesAPI.PriceCreateParams; + export import PriceUpdateParams = PricesAPI.PriceUpdateParams; + export import PriceListParams = PricesAPI.PriceListParams; + export import PriceEvaluateParams = PricesAPI.PriceEvaluateParams; export import ExternalPriceID = ExternalPriceIDAPI.ExternalPriceID; - export type ExternalPriceIDUpdateParams = ExternalPriceIDAPI.ExternalPriceIDUpdateParams; + export import ExternalPriceIDUpdateParams = ExternalPriceIDAPI.ExternalPriceIDUpdateParams; } diff --git a/src/resources/subscriptions.ts b/src/resources/subscriptions.ts index d42858ac..c4816083 100644 --- a/src/resources/subscriptions.ts +++ b/src/resources/subscriptions.ts @@ -266,15 +266,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 +277,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 +739,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 }); } @@ -966,18 +940,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 }); } @@ -15678,26 +15643,24 @@ export interface SubscriptionUpdateTrialParams { } export namespace Subscriptions { - export type Subscription = SubscriptionsAPI.Subscription; - export type SubscriptionUsage = SubscriptionsAPI.SubscriptionUsage; - export type Subscriptions = SubscriptionsAPI.Subscriptions; - export type SubscriptionFetchCostsResponse = SubscriptionsAPI.SubscriptionFetchCostsResponse; - export type SubscriptionFetchScheduleResponse = SubscriptionsAPI.SubscriptionFetchScheduleResponse; + export import Subscription = SubscriptionsAPI.Subscription; + export import SubscriptionUsage = SubscriptionsAPI.SubscriptionUsage; + export import Subscriptions = SubscriptionsAPI.Subscriptions; + export import SubscriptionFetchCostsResponse = SubscriptionsAPI.SubscriptionFetchCostsResponse; + export import SubscriptionFetchScheduleResponse = SubscriptionsAPI.SubscriptionFetchScheduleResponse; export import SubscriptionsPage = SubscriptionsAPI.SubscriptionsPage; export import SubscriptionFetchScheduleResponsesPage = SubscriptionsAPI.SubscriptionFetchScheduleResponsesPage; - export type SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; - export type SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; - export type SubscriptionListParams = SubscriptionsAPI.SubscriptionListParams; - export type SubscriptionCancelParams = SubscriptionsAPI.SubscriptionCancelParams; - export type SubscriptionFetchCostsParams = SubscriptionsAPI.SubscriptionFetchCostsParams; - export type SubscriptionFetchScheduleParams = SubscriptionsAPI.SubscriptionFetchScheduleParams; - export type SubscriptionFetchUsageParams = SubscriptionsAPI.SubscriptionFetchUsageParams; - export type SubscriptionPriceIntervalsParams = SubscriptionsAPI.SubscriptionPriceIntervalsParams; - export type SubscriptionSchedulePlanChangeParams = SubscriptionsAPI.SubscriptionSchedulePlanChangeParams; - export type SubscriptionTriggerPhaseParams = SubscriptionsAPI.SubscriptionTriggerPhaseParams; - export type SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = - SubscriptionsAPI.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams; - export type SubscriptionUpdateFixedFeeQuantityParams = - SubscriptionsAPI.SubscriptionUpdateFixedFeeQuantityParams; - export type SubscriptionUpdateTrialParams = SubscriptionsAPI.SubscriptionUpdateTrialParams; + export import SubscriptionCreateParams = SubscriptionsAPI.SubscriptionCreateParams; + export import SubscriptionUpdateParams = SubscriptionsAPI.SubscriptionUpdateParams; + export import SubscriptionListParams = SubscriptionsAPI.SubscriptionListParams; + export import SubscriptionCancelParams = SubscriptionsAPI.SubscriptionCancelParams; + export import SubscriptionFetchCostsParams = SubscriptionsAPI.SubscriptionFetchCostsParams; + export import SubscriptionFetchScheduleParams = SubscriptionsAPI.SubscriptionFetchScheduleParams; + export import SubscriptionFetchUsageParams = SubscriptionsAPI.SubscriptionFetchUsageParams; + export import SubscriptionPriceIntervalsParams = SubscriptionsAPI.SubscriptionPriceIntervalsParams; + export import SubscriptionSchedulePlanChangeParams = SubscriptionsAPI.SubscriptionSchedulePlanChangeParams; + export import SubscriptionTriggerPhaseParams = SubscriptionsAPI.SubscriptionTriggerPhaseParams; + export import SubscriptionUnscheduleFixedFeeQuantityUpdatesParams = SubscriptionsAPI.SubscriptionUnscheduleFixedFeeQuantityUpdatesParams; + export import SubscriptionUpdateFixedFeeQuantityParams = SubscriptionsAPI.SubscriptionUpdateFixedFeeQuantityParams; + export import SubscriptionUpdateTrialParams = SubscriptionsAPI.SubscriptionUpdateTrialParams; } diff --git a/src/resources/top-level.ts b/src/resources/top-level.ts index 2a58b130..6c53b7fa 100644 --- a/src/resources/top-level.ts +++ b/src/resources/top-level.ts @@ -23,5 +23,5 @@ export interface TopLevelPingResponse { } export namespace TopLevel { - export type TopLevelPingResponse = TopLevelAPI.TopLevelPingResponse; + export import TopLevelPingResponse = TopLevelAPI.TopLevelPingResponse; } 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(); diff --git a/tsconfig.json b/tsconfig.json index 90403f41..11064475 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -11,7 +11,7 @@ "paths": { "orb-billing/_shims/auto/*": ["src/_shims/auto/*-node"], "orb-billing/*": ["src/*"], - "orb-billing": ["src/index.ts"] + "orb-billing": ["src/index.ts"], }, "noEmit": true, @@ -32,7 +32,6 @@ "noUncheckedIndexedAccess": true, "noImplicitOverride": true, "noPropertyAccessFromIndexSignature": true, - "isolatedModules": true, "skipLibCheck": true }