Skip to content

Commit 69a1621

Browse files
committed
feat: add workflow apps and add a better description to service period
1 parent 39736aa commit 69a1621

7 files changed

Lines changed: 1013 additions & 786 deletions

File tree

api/spec/packages/aip-client-javascript/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export type {
116116
SubscriptionReference,
117117
AddonReference,
118118
AppReference,
119+
InvoiceWorkflowAppReference,
119120
ChargeReference,
120121
CurrencyFiat,
121122
FeatureReference,
@@ -218,6 +219,7 @@ export type {
218219
PlanAddon,
219220
CreatePlanAddonRequest,
220221
ProfileAppReferences,
222+
InvoiceWorkflowAppsReferences,
221223
ListEventsParamsFilter,
222224
ResourceFilters,
223225
FieldFilters,
@@ -272,14 +274,14 @@ export type {
272274
Supplier,
273275
AppStripeCreateCheckoutSessionRequestOptions,
274276
TaxCodePagePaginatedResponse,
275-
InvoiceWorkflowSettings,
276277
InvoiceDetailedLine,
277278
CurrencyPagePaginatedResponse,
278279
GovernanceQueryResult,
279280
Feature,
280281
CreateFeatureRequest,
281282
UpdateFeatureRequest,
282283
CreditGrantPagePaginatedResponse,
284+
InvoiceWorkflowSettings,
283285
BadRequest,
284286
InvoiceBase,
285287
CustomerStripeCreateCheckoutSessionRequest,
@@ -345,9 +347,9 @@ export type {
345347
IngestedEventPaginatedResponseInput,
346348
MeterQueryRequestInput,
347349
AppStripeCreateCheckoutSessionRequestOptionsInput,
348-
InvoiceWorkflowSettingsInput,
349350
InvoiceDetailedLineInput,
350351
CreditGrantPagePaginatedResponseInput,
352+
InvoiceWorkflowSettingsInput,
351353
BadRequestInput,
352354
CustomerStripeCreateCheckoutSessionRequestInput,
353355
WorkflowCollectionSettingsInput,

api/spec/packages/aip-client-javascript/src/models/schemas.ts

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1579,6 +1579,15 @@ export const appReference = z
15791579
})
15801580
.describe('App reference.')
15811581

1582+
export const invoiceWorkflowAppReference = z
1583+
.object({
1584+
id: ulid,
1585+
})
1586+
1587+
.describe(
1588+
'BillingInvoiceWorkflowAppReference Can be used as a short reference to an app if the full app object is not needed.',
1589+
)
1590+
15821591
export const chargeReference = z
15831592
.object({
15841593
id: ulid,
@@ -3277,6 +3286,17 @@ export const profileAppReferences = z
32773286
})
32783287
.describe('References to the applications used by a billing profile.')
32793288

3289+
export const invoiceWorkflowAppsReferences = z
3290+
.object({
3291+
tax: invoiceWorkflowAppReference,
3292+
invoicing: invoiceWorkflowAppReference,
3293+
payment: invoiceWorkflowAppReference,
3294+
})
3295+
3296+
.describe(
3297+
'BillingProfileAppReferences represents the references (id, type) to the apps used by a billing profile',
3298+
)
3299+
32803300
export const listEventsParamsFilter = z
32813301
.object({
32823302
id: stringFieldFilter.optional(),
@@ -4091,6 +4111,13 @@ export const planAddonPagePaginatedResponse = z
40914111
})
40924112
.describe('Page paginated response.')
40934113

4114+
export const invoiceWorkflowAppsOrReferences = z
4115+
.union([invoiceWorkflowAppsReferences])
4116+
4117+
.describe(
4118+
"Union of either the full app references or just the IDs of the apps used for this invoice's workflow. The `apps` field on `BillingInvoiceWorkflowSettings` is a union because the invoice may have been created before the app references were available. In that case only the IDs are returned, and the full references can be retrieved via separate API calls.",
4119+
)
4120+
40944121
export const ingestedEventPaginatedResponse = z
40954122
.object({
40964123
data: z.array(ingestedEvent),
@@ -4260,16 +4287,6 @@ export const taxCodePagePaginatedResponse = z
42604287
})
42614288
.describe('Page paginated response.')
42624289

4263-
export const invoiceWorkflowSettings = z
4264-
.object({
4265-
source_billing_profile: profileReference,
4266-
workflow: invoiceWorkflow,
4267-
})
4268-
4269-
.describe(
4270-
'Snapshot of the billing workflow configuration captured at invoice creation.',
4271-
)
4272-
42734290
export const invoiceDetailedLine = z
42744291
.object({
42754292
id: ulid,
@@ -4420,6 +4437,17 @@ export const creditGrantPagePaginatedResponse = z
44204437
})
44214438
.describe('Page paginated response.')
44224439

4440+
export const invoiceWorkflowSettings = z
4441+
.object({
4442+
apps: invoiceWorkflowAppsOrReferences.optional(),
4443+
source_billing_profile: profileReference,
4444+
workflow: invoiceWorkflow,
4445+
})
4446+
4447+
.describe(
4448+
'Snapshot of the billing workflow configuration captured at invoice creation.',
4449+
)
4450+
44234451
export const badRequest = z
44244452
.intersection(
44254453
baseError,

api/spec/packages/aip-client-javascript/src/models/types.ts

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,12 @@ export interface AppReference {
659659
id: string
660660
}
661661

662+
/** BillingInvoiceWorkflowAppReference Can be used as a short reference to an app if the full app object is not needed. */
663+
export interface InvoiceWorkflowAppReference {
664+
/** The ID of the app. */
665+
id: string
666+
}
667+
662668
/** Reference to a charge associated with an invoice line. */
663669
export interface ChargeReference {
664670
/** Unique identifier for the charge. */
@@ -2036,6 +2042,16 @@ export interface ProfileAppReferences {
20362042
payment: AppReference
20372043
}
20382044

2045+
/** BillingProfileAppReferences represents the references (id, type) to the apps used by a billing profile */
2046+
export interface InvoiceWorkflowAppsReferences {
2047+
/** The tax app used for this workflow */
2048+
tax: InvoiceWorkflowAppReference
2049+
/** The invoicing app used for this workflow */
2050+
invoicing: InvoiceWorkflowAppReference
2051+
/** The payment app used for this workflow */
2052+
payment: InvoiceWorkflowAppReference
2053+
}
2054+
20392055
/** Filter options for listing ingested events. */
20402056
export interface ListEventsParamsFilter {
20412057
/** Filter events by ID. */
@@ -2828,14 +2844,6 @@ export interface TaxCodePagePaginatedResponse {
28282844
meta: PaginatedMeta
28292845
}
28302846

2831-
/** Snapshot of the billing workflow configuration captured at invoice creation. */
2832-
export interface InvoiceWorkflowSettings {
2833-
/** The billing profile that was the source of this workflow snapshot. */
2834-
source_billing_profile: ProfileReference
2835-
/** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
2836-
workflow: InvoiceWorkflow
2837-
}
2838-
28392847
/** A detailed (child) sub-line belonging to a parent invoice line. Detailed lines represent the individual flat-fee components that make up a usage-based parent line after quantity snapshotting. */
28402848
export interface InvoiceDetailedLine {
28412849
id: string
@@ -2933,6 +2941,16 @@ export interface CreditGrantPagePaginatedResponse {
29332941
meta: PaginatedMeta
29342942
}
29352943

2944+
/** Snapshot of the billing workflow configuration captured at invoice creation. */
2945+
export interface InvoiceWorkflowSettings {
2946+
/** The apps that will be used to orchestrate the invoice's workflow. */
2947+
apps?: InvoiceWorkflowAppsReferences
2948+
/** The billing profile that was the source of this workflow snapshot. */
2949+
source_billing_profile: ProfileReference
2950+
/** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
2951+
workflow: InvoiceWorkflow
2952+
}
2953+
29362954
/** Bad Request. */
29372955
export interface BadRequest extends BaseError {
29382956
/** The list of parameters that failed validation. */
@@ -3241,7 +3259,7 @@ export interface InvoiceStandardLine {
32413259
type: 'standard_line'
32423260
/** Indicates whether this line item's lifecycle is controlled by OpenMeter or manually overridden by the API user. */
32433261
lifecycle_controller: 'system' | 'manual'
3244-
/** The service period covered by this line item. */
3262+
/** The service period covered by this invoice, spanning the earliest line start to the latest line end across all of its lines. For an invoice with no lines the period is empty, which means `from` will be equal to `to`. */
32453263
service_period: ClosedPeriod
32463264
/** Aggregated financial totals for the line item. */
32473265
totals: Totals
@@ -3874,13 +3892,6 @@ export interface AppStripeCreateCheckoutSessionRequestOptionsInput {
38743892
tax_id_collection?: AppStripeCreateCheckoutSessionTaxIdCollectionInput
38753893
}
38763894

3877-
export interface InvoiceWorkflowSettingsInput {
3878-
/** The billing profile that was the source of this workflow snapshot. */
3879-
source_billing_profile: ProfileReference
3880-
/** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
3881-
workflow: InvoiceWorkflowInput
3882-
}
3883-
38843895
export interface InvoiceDetailedLineInput {
38853896
id: string
38863897
/** Display name of the resource. Between 1 and 256 characters. */
@@ -3917,6 +3928,15 @@ export interface CreditGrantPagePaginatedResponseInput {
39173928
meta: PaginatedMeta
39183929
}
39193930

3931+
export interface InvoiceWorkflowSettingsInput {
3932+
/** The apps that will be used to orchestrate the invoice's workflow. */
3933+
apps?: InvoiceWorkflowAppsReferences
3934+
/** The billing profile that was the source of this workflow snapshot. */
3935+
source_billing_profile: ProfileReference
3936+
/** The workflow configuration that was active when the invoice was created. Only the fields that are meaningful at the per-invoice level are included: invoicing behaviour (auto-advance, draft period) and payment settings (collection method, due date). Profile-wide settings such as collection alignment, progressive billing, and tax policy are omitted. */
3937+
workflow: InvoiceWorkflowInput
3938+
}
3939+
39203940
export interface BadRequestInput extends BaseErrorInput {
39213941
/** The list of parameters that failed validation. */
39223942
invalid_parameters: (
@@ -4002,7 +4022,7 @@ export interface InvoiceStandardLineInput {
40024022
type: 'standard_line'
40034023
/** Indicates whether this line item's lifecycle is controlled by OpenMeter or manually overridden by the API user. */
40044024
lifecycle_controller: 'system' | 'manual'
4005-
/** The service period covered by this line item. */
4025+
/** The service period covered by this invoice, spanning the earliest line start to the latest line end across all of its lines. For an invoice with no lines the period is empty, which means `from` will be equal to `to`. */
40064026
service_period: ClosedPeriod
40074027
/** Aggregated financial totals for the line item. */
40084028
totals: Totals

api/spec/packages/aip/src/invoices/invoice.tsp

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,13 @@ model Supplier {
365365
*/
366366
@friendlyName("BillingInvoiceWorkflowSettings")
367367
model InvoiceWorkflowSettings {
368+
/**
369+
* The apps that will be used to orchestrate the invoice's workflow.
370+
*/
371+
@visibility(Lifecycle.Read)
372+
@summary("Application that generated the invoice")
373+
apps?: InvoiceWorkflowAppsOrReferences;
374+
368375
/**
369376
* The billing profile that was the source of this workflow snapshot.
370377
*/
@@ -385,6 +392,58 @@ model InvoiceWorkflowSettings {
385392
workflow: BillingInvoiceWorkflow;
386393
}
387394

395+
/**
396+
* Union of either the full app references or just the IDs of the apps used for
397+
* this invoice's workflow.
398+
*
399+
* The `apps` field on `BillingInvoiceWorkflowSettings` is a union because the
400+
* invoice may have been created before the app references were available. In that
401+
* case only the IDs are returned, and the full references can be retrieved via
402+
* separate API calls.
403+
*/
404+
@friendlyName("BillingInvoiceWorkflowAppsOrReferences")
405+
union InvoiceWorkflowAppsOrReferences {
406+
references: InvoiceWorkflowAppsReferences,
407+
}
408+
409+
/**
410+
* BillingProfileAppReferences represents the references (id, type) to the apps
411+
* used by a billing profile
412+
*/
413+
@friendlyName("BillingInvoiceWorkflowAppsReferences")
414+
model InvoiceWorkflowAppsReferences {
415+
/**
416+
* The tax app used for this workflow
417+
*/
418+
@visibility(Lifecycle.Read)
419+
tax: InvoiceWorkflowAppReference;
420+
421+
/**
422+
* The invoicing app used for this workflow
423+
*/
424+
@visibility(Lifecycle.Read)
425+
invoicing: InvoiceWorkflowAppReference;
426+
427+
/**
428+
* The payment app used for this workflow
429+
*/
430+
@visibility(Lifecycle.Read)
431+
payment: InvoiceWorkflowAppReference;
432+
}
433+
434+
/**
435+
* BillingInvoiceWorkflowAppReference
436+
*
437+
* Can be used as a short reference to an app if the full app object is not needed.
438+
*/
439+
@friendlyName("BillingInvoiceWorkflowAppReference")
440+
model InvoiceWorkflowAppReference {
441+
/**
442+
* The ID of the app.
443+
*/
444+
id: Shared.ULID;
445+
}
446+
388447
/**
389448
* Invoice-level snapshot of the workflow configuration.
390449
*
@@ -630,7 +689,11 @@ model InvoiceStandardLine {
630689
lifecycle_controller: Shared.LifecycleController;
631690

632691
/**
633-
* The service period covered by this line item.
692+
* The service period covered by this invoice, spanning the earliest line start to
693+
* the latest line end across all of its lines.
694+
*
695+
* For an invoice with no lines the period is empty, which means `from` will be
696+
* equal to `to`.
634697
*/
635698
@visibility(Lifecycle.Read)
636699
@summary("Service period")

0 commit comments

Comments
 (0)