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
9 changes: 5 additions & 4 deletions api/spec/packages/aip-client-javascript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,11 @@ The full call path, HTTP route, and a short description are listed below.

### Invoices

| Method | HTTP | Description |
| ---------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
| `client.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
| Method | HTTP | Description |
| ------------------------ | --------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `client.invoices.list` | `GET /openmeter/billing/invoices` | List billing invoices. Returns a page of invoices. Gathering invoices are never included. Use `filter` to narrow by status, customer, dates, or service period start. Use `sort` to control ordering. |
| `client.invoices.get` | `GET /openmeter/billing/invoices/{invoiceId}` | Get a billing invoice by ID. Returns the full invoice resource including line items, status details, totals, and workflow configuration snapshot. |
| `client.invoices.update` | `PUT /openmeter/billing/invoices/{invoiceId}` | Update a billing invoice. Only the mutable fields of the invoice can be edited: description, labels, supplier, customer, workflow settings, and top-level lines. Top-level lines are matched by `id`; lines without an `id` are created, and existing lines omitted from `lines` are deleted. Detailed (child) lines are always computed and cannot be edited directly. Only invoices in draft status can be updated. |

### Tax

Expand Down
17 changes: 17 additions & 0 deletions api/spec/packages/aip-client-javascript/src/funcs/invoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type {
ListInvoicesResponse,
GetInvoiceRequest,
GetInvoiceResponse,
UpdateInvoiceRequest,
UpdateInvoiceResponse,
} from '../models/operations/invoices.js'

export function listInvoices(
Expand Down Expand Up @@ -38,3 +40,18 @@ export function getInvoice(
http(client).get(path, options).json<GetInvoiceResponse>(),
)
}

export function updateInvoice(
client: Client,
req: UpdateInvoiceRequest,
options?: RequestOptions,
): Promise<Result<UpdateInvoiceResponse>> {
const path = encodePath('openmeter/billing/invoices/{invoiceId}', {
invoiceId: req.invoiceId,
})
return request(() =>
http(client)
.put(path, { ...options, json: req.body })
.json<UpdateInvoiceResponse>(),
)
}
31 changes: 31 additions & 0 deletions api/spec/packages/aip-client-javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export type {
InvoiceAvailableActionDetails,
InvoiceWorkflowInvoicingSettings,
InvoiceLineExternalReferences,
UpdateLabels,
UpdateBillingInvoiceWorkflowInvoicingSettings,
UpdateBillingWorkflowPaymentChargeAutomaticallySettings,
UpdateBillingWorkflowPaymentSendInvoiceSettings,
UpdatePriceFree,
LlmCostProvider,
LlmCostModel,
ProductCatalogValidationError,
Expand All @@ -100,6 +105,9 @@ export type {
Totals,
SpendCommitments,
InvoiceLineCreditsApplied,
UpdatePriceFlat,
UpdatePriceUnit,
UpdateDiscounts,
FeatureManualUnitCost,
FeatureLlmUnitCostPricing,
LlmCostModelPricing,
Expand All @@ -119,11 +127,13 @@ export type {
FeatureReference,
AppReference,
ChargeReference,
UpdateResourceReference,
Event,
MeterQueryRow,
AppStripeCreateCustomerPortalSessionResult,
ClosedPeriod,
SubscriptionAddonTimelineSegment,
UpdateClosedPeriod,
CostBasis,
CreateCostBasisRequest,
FeatureCostQueryRow,
Expand Down Expand Up @@ -158,7 +168,9 @@ export type {
QueryFilterStringMapItem,
CustomerKeyReference,
CustomerUsageAttribution,
UpdateCustomerUsageAttribution,
Address,
UpdateAddress,
AppStripeCreateCheckoutSessionCustomerUpdate,
AppStripeCreateCheckoutSessionConsentCollectionPaymentMethodReuseAgreement,
AppStripeCreateCheckoutSessionTaxIdCollection,
Expand All @@ -181,6 +193,7 @@ export type {
AppCatalogItem,
TaxCodeAppMapping,
PartyTaxIdentity,
UpdateBillingPartyTaxIdentity,
WorkflowInvoicingSettings,
InvoiceValidationIssue,
InvoiceAvailableActions,
Expand All @@ -202,6 +215,7 @@ export type {
CreditTransaction,
PriceTier,
ChargeTotals,
UpdatePriceTier,
FeatureLlmUnitCost,
LlmCostPrice,
LlmCostOverrideCreate,
Expand All @@ -219,6 +233,7 @@ export type {
CreatePlanAddonRequest,
ProfileAppReferences,
InvoiceWorkflowAppsReferences,
UpdateRateCardTaxConfig,
ListEventsParamsFilter,
ListInvoicesParamsFilter,
ResourceFilters,
Expand All @@ -235,6 +250,8 @@ export type {
UpsertCustomerRequest,
PartyAddresses,
InvoiceCustomer,
UpdateBillingPartyAddresses,
UpdateInvoiceCustomer,
AppStripeCreateCheckoutSessionConsentCollection,
ListCustomerEntitlementAccessResponseData,
WorkflowCollectionAlignmentAnchored,
Expand All @@ -254,13 +271,15 @@ export type {
InvoiceWorkflow,
InvoiceStatusDetails,
InvoiceLineDiscounts,
UpdateBillingInvoiceWorkflow,
GovernanceFeatureAccess,
CustomerData,
UpsertCustomerBillingDataRequest,
CreditBalances,
CreditTransactionPaginatedResponse,
PriceGraduated,
PriceVolume,
Array,
PricePagePaginatedResponse,
CreateCreditGrantRequest,
CreditGrant,
Expand All @@ -273,12 +292,16 @@ export type {
CustomerPagePaginatedResponse,
Party,
Supplier,
UpdateSupplier,
AppStripeCreateCheckoutSessionRequestOptions,
TaxCodePagePaginatedResponse,
InvoiceWorkflowSettings,
InvoiceDetailedLine,
UpdateInvoiceWorkflowSettings,
CurrencyPagePaginatedResponse,
GovernanceQueryResult,
UpdatePriceGraduated,
UpdatePriceVolume,
Feature,
CreateFeatureRequest,
UpdateFeatureRequest,
Expand All @@ -304,6 +327,7 @@ export type {
CreateAddonRequest,
UpsertAddonRequest,
InvoiceStandardLine,
UpdateInvoiceLineRateCard,
Profile,
CreateBillingProfileRequest,
UpsertBillingProfileRequest,
Expand All @@ -312,16 +336,20 @@ export type {
CreatePlanRequest,
UpsertPlanRequest,
AddonPagePaginatedResponse,
UpdateInvoiceStandardLine,
ProfilePagePaginatedResponse,
ChargePagePaginatedResponse,
SubscriptionAddonPagePaginatedResponse,
PlanPagePaginatedResponse,
InvoiceStandard,
InvoicePagePaginatedResponse,
UpdateInvoiceStandardRequest,
SortQueryInput,
BaseErrorInput,
WorkflowPaymentSendInvoiceSettingsInput,
InvoiceWorkflowInvoicingSettingsInput,
UpdateBillingInvoiceWorkflowInvoicingSettingsInput,
UpdateBillingWorkflowPaymentSendInvoiceSettingsInput,
EventInput,
UnauthorizedInput,
ForbiddenInput,
Expand All @@ -347,6 +375,7 @@ export type {
SubscriptionCancelInput,
InvoiceUsageQuantityDetailInput,
InvoiceWorkflowInput,
UpdateBillingInvoiceWorkflowInput,
CreateCreditGrantRequestInput,
CreditGrantInput,
WorkflowTaxSettingsInput,
Expand All @@ -355,6 +384,7 @@ export type {
AppStripeCreateCheckoutSessionRequestOptionsInput,
InvoiceWorkflowSettingsInput,
InvoiceDetailedLineInput,
UpdateInvoiceWorkflowSettingsInput,
CreditGrantPagePaginatedResponseInput,
BadRequestInput,
CustomerStripeCreateCheckoutSessionRequestInput,
Expand All @@ -380,4 +410,5 @@ export type {
PlanPagePaginatedResponseInput,
InvoiceStandardInput,
InvoicePagePaginatedResponseInput,
UpdateInvoiceStandardRequestInput,
} from './models/types.js'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
InvoicePagePaginatedResponse,
ListInvoicesParamsFilter,
SortQueryInput,
UpdateInvoiceStandardRequestInput,
} from '../types.js'

export interface ListInvoicesQuery {
Expand Down Expand Up @@ -39,3 +40,11 @@ export type GetInvoiceRequest = {
invoiceId: string
}
export type GetInvoiceResponse = z.output<typeof schemas.getInvoiceResponse>

export type UpdateInvoiceRequest = {
invoiceId: string
body: UpdateInvoiceStandardRequestInput
}
export type UpdateInvoiceResponse = z.output<
typeof schemas.updateInvoiceResponse
>
Loading
Loading