Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/spec/packages/aip-client-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ The full call path, HTTP route, and a short description are listed below.
| `client.subscriptions.cancel` | `POST /openmeter/subscriptions/{subscriptionId}/cancel` | Cancels the subscription. Will result in a scheduling conflict if there are other subscriptions scheduled to start after the cancelation time. |
| `client.subscriptions.unscheduleCancelation` | `POST /openmeter/subscriptions/{subscriptionId}/unschedule-cancelation` | Unschedules the subscription cancelation. |
| `client.subscriptions.change` | `POST /openmeter/subscriptions/{subscriptionId}/change` | Closes a running subscription and starts a new one according to the specification. Can be used for upgrades, downgrades, and plan changes. |
| `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the addons of a subscription. |
| `client.subscriptions.createAddon` | `POST /openmeter/subscriptions/{subscriptionId}/addons` | Add add-on to a subscription. |
| `client.subscriptions.listAddons` | `GET /openmeter/subscriptions/{subscriptionId}/addons` | List the add-ons of a subscription. |
| `client.subscriptions.getAddon` | `GET /openmeter/subscriptions/{subscriptionId}/addons/{subscriptionAddonId}` | Get an add-on association for a subscription. |

### Apps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import type {
UnscheduleCancelationResponse,
ChangeSubscriptionRequest,
ChangeSubscriptionResponse,
CreateSubscriptionAddonRequest,
CreateSubscriptionAddonResponse,
ListSubscriptionAddonsRequest,
ListSubscriptionAddonsResponse,
GetSubscriptionAddonRequest,
Expand Down Expand Up @@ -107,6 +109,21 @@ export function changeSubscription(
)
}

export function createSubscriptionAddon(
client: Client,
req: CreateSubscriptionAddonRequest,
options?: RequestOptions,
): Promise<Result<CreateSubscriptionAddonResponse>> {
const path = encodePath('openmeter/subscriptions/{subscriptionId}/addons', {
subscriptionId: req.subscriptionId,
})
return request(() =>
http(client)
.post(path, { ...options, json: req.body })
.json<CreateSubscriptionAddonResponse>(),
)
}

export function listSubscriptionAddons(
client: Client,
req: ListSubscriptionAddonsRequest,
Expand Down
38 changes: 22 additions & 16 deletions api/spec/packages/aip-client-javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export type {
TaxConfigExternalInvoicing,
ChargeFlatFeeDiscounts,
PriceFree,
RateCardStaticEntitlement,
RateCardBooleanEntitlement,
WorkflowCollectionAlignmentSubscription,
WorkflowPaymentChargeAutomaticallySettings,
WorkflowPaymentSendInvoiceSettings,
Expand All @@ -75,8 +77,6 @@ export type {
InvoiceLineExternalReferences,
LlmCostProvider,
LlmCostModel,
RateCardStaticEntitlement,
RateCardBooleanEntitlement,
ProductCatalogValidationError,
GovernanceQueryRequestCustomers,
GovernanceQueryRequestFeatures,
Expand All @@ -97,11 +97,11 @@ export type {
PriceUnit,
RateCardDiscounts,
Totals,
SpendCommitments,
InvoiceLineCreditsApplied,
FeatureManualUnitCost,
FeatureLlmUnitCostPricing,
LlmCostModelPricing,
SpendCommitments,
QueryFilterNumeric,
CursorPaginationQuery,
ListMetersParamsFilter,
Expand All @@ -115,14 +115,15 @@ export type {
BillingCustomerReference,
SubscriptionReference,
AddonReference,
FeatureReference,
AppReference,
ChargeReference,
CurrencyFiat,
FeatureReference,
Event,
MeterQueryRow,
AppStripeCreateCustomerPortalSessionResult,
ClosedPeriod,
SubscriptionAddonTimelineSegment,
CostBasis,
CreateCostBasisRequest,
FeatureCostQueryRow,
Expand Down Expand Up @@ -165,8 +166,8 @@ export type {
CustomerStripeCreateCustomerPortalSessionRequest,
EntitlementAccessResult,
CreateCreditGrantPurchase,
RecurringPeriod,
RateCardMeteredEntitlement,
RecurringPeriod,
CreditGrantPurchase,
UpdateCreditGrantExternalSettlementRequest,
ListCreditGrantsParamsFilter,
Expand All @@ -176,6 +177,7 @@ export type {
SubscriptionCreate,
RateCardProrationConfiguration,
Subscription,
UnitConfig,
AppCatalogItem,
TaxCodeAppMapping,
PartyTaxIdentity,
Expand All @@ -188,7 +190,6 @@ export type {
ListCurrenciesParamsFilter,
CurrencyCustom,
CreateCurrencyCustomRequest,
UnitConfig,
GovernanceQueryRequest,
GovernanceFeatureAccessReason,
GovernanceQueryError,
Expand All @@ -214,7 +215,6 @@ export type {
RateCardTaxConfig,
OrganizationDefaultTaxCodes,
UpdateOrganizationDefaultTaxCodesRequest,
SubscriptionAddon,
PlanAddon,
CreatePlanAddonRequest,
ProfileAppReferences,
Expand All @@ -241,6 +241,8 @@ export type {
SubscriptionChangeResponse,
SubscriptionCancel,
SubscriptionChange,
CreateSubscriptionAddonRequest,
InvoiceUsageQuantityDetail,
AppStripe,
AppSandbox,
AppExternalInvoicing,
Expand All @@ -250,7 +252,6 @@ export type {
InvoiceWorkflow,
InvoiceStatusDetails,
InvoiceLineDiscounts,
InvoiceUsageQuantityDetail,
GovernanceFeatureAccess,
CustomerData,
UpsertCustomerBillingDataRequest,
Expand All @@ -263,7 +264,6 @@ export type {
CreditGrant,
CreateChargeFlatFeeRequest,
WorkflowTaxSettings,
SubscriptionAddonPagePaginatedResponse,
PlanAddonPagePaginatedResponse,
IngestedEventPaginatedResponse,
InvalidParameters,
Expand Down Expand Up @@ -291,26 +291,29 @@ export type {
ChargeFlatFee,
ChargeUsageBased,
CreateChargeUsageBasedRequest,
InvoiceLineRateCard,
RateCard,
InvoiceLineRateCard,
FeaturePagePaginatedResponse,
Workflow,
InvoiceStandardLine,
SubscriptionAddonRateCard,
PlanPhase,
Addon,
CreateAddonRequest,
UpsertAddonRequest,
InvoiceStandardLine,
Profile,
CreateBillingProfileRequest,
UpsertBillingProfileRequest,
ChargePagePaginatedResponse,
SubscriptionAddon,
Plan,
CreatePlanRequest,
UpsertPlanRequest,
AddonPagePaginatedResponse,
ProfilePagePaginatedResponse,
InvoiceStandard,
SubscriptionAddonPagePaginatedResponse,
PlanPagePaginatedResponse,
InvoiceStandard,
SortQueryInput,
BaseErrorInput,
WorkflowPaymentSendInvoiceSettingsInput,
Expand All @@ -333,13 +336,13 @@ export type {
CreateCreditGrantPurchaseInput,
RateCardMeteredEntitlementInput,
CreditGrantPurchaseInput,
WorkflowInvoicingSettingsInput,
UnitConfigInput,
WorkflowInvoicingSettingsInput,
GovernanceQueryRequestInput,
IngestedEventInput,
SubscriptionCancelInput,
InvoiceWorkflowInput,
InvoiceUsageQuantityDetailInput,
InvoiceWorkflowInput,
CreateCreditGrantRequestInput,
CreditGrantInput,
WorkflowTaxSettingsInput,
Expand All @@ -354,19 +357,22 @@ export type {
WorkflowCollectionSettingsInput,
RateCardInput,
WorkflowInput,
InvoiceStandardLineInput,
SubscriptionAddonRateCardInput,
PlanPhaseInput,
AddonInput,
CreateAddonRequestInput,
UpsertAddonRequestInput,
InvoiceStandardLineInput,
ProfileInput,
CreateBillingProfileRequestInput,
UpsertBillingProfileRequestInput,
SubscriptionAddonInput,
PlanInput,
CreatePlanRequestInput,
UpsertPlanRequestInput,
AddonPagePaginatedResponseInput,
ProfilePagePaginatedResponseInput,
InvoiceStandardInput,
SubscriptionAddonPagePaginatedResponseInput,
PlanPagePaginatedResponseInput,
InvoiceStandardInput,
} from './models/types.js'
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { z } from 'zod'
import * as schemas from '../schemas.js'
import type {
CreateSubscriptionAddonRequest as CreateSubscriptionAddonRequestBody,
ListSubscriptionsParamsFilter,
SortQueryInput,
Subscription,
Expand Down Expand Up @@ -59,6 +60,12 @@ export type ChangeSubscriptionRequest = {
}
export type ChangeSubscriptionResponse = SubscriptionChangeResponse

export type CreateSubscriptionAddonRequest = {
subscriptionId: string
body: CreateSubscriptionAddonRequestBody
}
export type CreateSubscriptionAddonResponse = SubscriptionAddon

export interface ListSubscriptionAddonsQuery {
/** Determines which page of the collection to retrieve. */
page?: { size?: number; number?: number }
Expand Down
Loading
Loading