Skip to content

Commit aef1d24

Browse files
committed
feat: generation
1 parent f9c7b7e commit aef1d24

File tree

23 files changed

+6764
-6599
lines changed

23 files changed

+6764
-6599
lines changed

packages/clients/src/api/billing/v2alpha1/api.gen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export class API extends ParentAPI {
106106
method: 'GET',
107107
path: `/billing/v2alpha1/discounts`,
108108
urlParams: urlParams(
109-
['order_by', request.orderBy ?? 'creation_date_desc'],
109+
['order_by', request.orderBy],
110110
['organization_id', request.organizationId],
111111
['page', request.page],
112112
[

packages/clients/src/api/billing/v2alpha1/marshalling.gen.ts

Lines changed: 57 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,68 @@ import type {
1717
ListInvoicesResponse,
1818
} from './types.gen'
1919

20-
const unmarshalDiscountCoupon = (data: unknown) => {
20+
const unmarshalGetConsumptionResponseConsumption = (
21+
data: unknown,
22+
): GetConsumptionResponseConsumption => {
23+
if (!isJSONObject(data)) {
24+
throw new TypeError(
25+
`Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary.`,
26+
)
27+
}
28+
29+
return {
30+
category: data.category,
31+
description: data.description,
32+
operationPath: data.operation_path,
33+
projectId: data.project_id,
34+
value: data.value ? unmarshalMoney(data.value) : undefined,
35+
} as GetConsumptionResponseConsumption
36+
}
37+
38+
export const unmarshalGetConsumptionResponse = (
39+
data: unknown,
40+
): GetConsumptionResponse => {
41+
if (!isJSONObject(data)) {
42+
throw new TypeError(
43+
`Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary.`,
44+
)
45+
}
46+
47+
return {
48+
consumptions: unmarshalArrayOfObject(
49+
data.consumptions,
50+
unmarshalGetConsumptionResponseConsumption,
51+
),
52+
updatedAt: unmarshalDate(data.updated_at),
53+
} as GetConsumptionResponse
54+
}
55+
56+
const unmarshalDiscountCoupon = (data: unknown): DiscountCoupon => {
2157
if (!isJSONObject(data)) {
2258
throw new TypeError(
2359
`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`,
2460
)
2561
}
2662

27-
return { description: data.description } as DiscountCoupon
63+
return {
64+
description: data.description,
65+
} as DiscountCoupon
2866
}
2967

30-
const unmarshalDiscountFilter = (data: unknown) => {
68+
const unmarshalDiscountFilter = (data: unknown): DiscountFilter => {
3169
if (!isJSONObject(data)) {
3270
throw new TypeError(
3371
`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`,
3472
)
3573
}
3674

37-
return { type: data.type, value: data.value } as DiscountFilter
75+
return {
76+
type: data.type,
77+
value: data.value,
78+
} as DiscountFilter
3879
}
3980

40-
const unmarshalDiscount = (data: unknown) => {
81+
const unmarshalDiscount = (data: unknown): Discount => {
4182
if (!isJSONObject(data)) {
4283
throw new TypeError(
4384
`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`,
@@ -60,23 +101,22 @@ const unmarshalDiscount = (data: unknown) => {
60101
} as Discount
61102
}
62103

63-
const unmarshalGetConsumptionResponseConsumption = (data: unknown) => {
104+
export const unmarshalListDiscountsResponse = (
105+
data: unknown,
106+
): ListDiscountsResponse => {
64107
if (!isJSONObject(data)) {
65108
throw new TypeError(
66-
`Unmarshalling the type 'GetConsumptionResponseConsumption' failed as data isn't a dictionary.`,
109+
`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`,
67110
)
68111
}
69112

70113
return {
71-
category: data.category,
72-
description: data.description,
73-
operationPath: data.operation_path,
74-
projectId: data.project_id,
75-
value: data.value ? unmarshalMoney(data.value) : undefined,
76-
} as GetConsumptionResponseConsumption
114+
discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
115+
totalCount: data.total_count,
116+
} as ListDiscountsResponse
77117
}
78118

79-
const unmarshalInvoice = (data: unknown) => {
119+
const unmarshalInvoice = (data: unknown): Invoice => {
80120
if (!isJSONObject(data)) {
81121
throw new TypeError(
82122
`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`,
@@ -97,36 +137,9 @@ const unmarshalInvoice = (data: unknown) => {
97137
} as Invoice
98138
}
99139

100-
export const unmarshalGetConsumptionResponse = (data: unknown) => {
101-
if (!isJSONObject(data)) {
102-
throw new TypeError(
103-
`Unmarshalling the type 'GetConsumptionResponse' failed as data isn't a dictionary.`,
104-
)
105-
}
106-
107-
return {
108-
consumptions: unmarshalArrayOfObject(
109-
data.consumptions,
110-
unmarshalGetConsumptionResponseConsumption,
111-
),
112-
updatedAt: unmarshalDate(data.updated_at),
113-
} as GetConsumptionResponse
114-
}
115-
116-
export const unmarshalListDiscountsResponse = (data: unknown) => {
117-
if (!isJSONObject(data)) {
118-
throw new TypeError(
119-
`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`,
120-
)
121-
}
122-
123-
return {
124-
discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
125-
totalCount: data.total_count,
126-
} as ListDiscountsResponse
127-
}
128-
129-
export const unmarshalListInvoicesResponse = (data: unknown) => {
140+
export const unmarshalListInvoicesResponse = (
141+
data: unknown,
142+
): ListInvoicesResponse => {
130143
if (!isJSONObject(data)) {
131144
throw new TypeError(
132145
`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`,

packages/clients/src/api/billing/v2alpha1/types.gen.ts

Lines changed: 63 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,31 @@ export type ListInvoicesRequestOrderBy =
4141
| 'invoice_type_desc'
4242
| 'invoice_type_asc'
4343

44-
/** Discount. */
44+
export interface DiscountCoupon {
45+
/** The description of the coupon. */
46+
description?: string
47+
}
48+
49+
export interface DiscountFilter {
50+
/** Type of the filter. */
51+
type: DiscountFilterType
52+
/** Value of filter, it can be a product/range/region/zone value. */
53+
value: string
54+
}
55+
56+
export interface GetConsumptionResponseConsumption {
57+
/** Monetary value of the consumption. */
58+
value?: Money
59+
/** Description of the consumption. */
60+
description: string
61+
/** Project ID of the consumption. */
62+
projectId: string
63+
/** Category of the consumption. */
64+
category: string
65+
/** Unique identifier of the product. */
66+
operationPath: string
67+
}
68+
4569
export interface Discount {
4670
/** The ID of the discount. */
4771
id: string
@@ -69,43 +93,6 @@ export interface Discount {
6993
filters: DiscountFilter[]
7094
}
7195

72-
/** Discount. coupon. */
73-
export interface DiscountCoupon {
74-
/** The description of the coupon. */
75-
description?: string
76-
}
77-
78-
/** Discount. filter. */
79-
export interface DiscountFilter {
80-
/** Type of the filter. */
81-
type: DiscountFilterType
82-
/** Value of filter, it can be a product/range/region/zone value. */
83-
value: string
84-
}
85-
86-
/** Get consumption response. */
87-
export interface GetConsumptionResponse {
88-
/** Detailed consumption list. */
89-
consumptions: GetConsumptionResponseConsumption[]
90-
/** Last consumption update date. */
91-
updatedAt?: Date
92-
}
93-
94-
/** Get consumption response. consumption. */
95-
export interface GetConsumptionResponseConsumption {
96-
/** Monetary value of the consumption. */
97-
value?: Money
98-
/** Description of the consumption. */
99-
description: string
100-
/** Project ID of the consumption. */
101-
projectId: string
102-
/** Category of the consumption. */
103-
category: string
104-
/** Unique identifier of the product. */
105-
operationPath: string
106-
}
107-
108-
/** Invoice. */
10996
export interface Invoice {
11097
/** Invoice ID. */
11198
id: string
@@ -125,27 +112,46 @@ export interface Invoice {
125112
number: number
126113
}
127114

128-
/** List discounts response. */
129-
export interface ListDiscountsResponse {
130-
/** Total number of discounts. */
131-
totalCount: number
132-
/** Paginated returned discounts. */
133-
discounts: Discount[]
134-
}
135-
136-
/** List invoices response. */
137-
export interface ListInvoicesResponse {
138-
/** Total number of invoices. */
139-
totalCount: number
140-
/** Paginated returned invoices. */
141-
invoices: Invoice[]
115+
export type DownloadInvoiceRequest = {
116+
/** Invoice ID. */
117+
invoiceId: string
118+
/** Wanted file type. */
119+
fileType?: DownloadInvoiceRequestFileType
142120
}
143121

144122
export type GetConsumptionRequest = {
145123
/** Filter by organization ID. */
146124
organizationId?: string
147125
}
148126

127+
export interface GetConsumptionResponse {
128+
/** Detailed consumption list. */
129+
consumptions: GetConsumptionResponseConsumption[]
130+
/** Last consumption update date. */
131+
updatedAt?: Date
132+
}
133+
134+
export type ListDiscountsRequest = {
135+
/** Order discounts in the response by their description. */
136+
orderBy?: ListDiscountsRequestOrderBy
137+
/** Positive integer to choose the page to return. */
138+
page?: number
139+
/**
140+
* Positive integer lower or equal to 100 to select the number of items to
141+
* return.
142+
*/
143+
pageSize?: number
144+
/** ID of the organization. */
145+
organizationId?: string
146+
}
147+
148+
export interface ListDiscountsResponse {
149+
/** Total number of discounts. */
150+
totalCount: number
151+
/** Paginated returned discounts. */
152+
discounts: Discount[]
153+
}
154+
149155
export type ListInvoicesRequest = {
150156
/**
151157
* Organization ID to filter for, only invoices from this Organization will be
@@ -169,23 +175,9 @@ export type ListInvoicesRequest = {
169175
orderBy?: ListInvoicesRequestOrderBy
170176
}
171177

172-
export type DownloadInvoiceRequest = {
173-
/** Invoice ID. */
174-
invoiceId: string
175-
/** Wanted file type. */
176-
fileType?: DownloadInvoiceRequestFileType
177-
}
178-
179-
export type ListDiscountsRequest = {
180-
/** Order discounts in the response by their description. */
181-
orderBy?: ListDiscountsRequestOrderBy
182-
/** Positive integer to choose the page to return. */
183-
page?: number
184-
/**
185-
* Positive integer lower or equal to 100 to select the number of items to
186-
* return.
187-
*/
188-
pageSize?: number
189-
/** ID of the organization. */
190-
organizationId?: string
178+
export interface ListInvoicesResponse {
179+
/** Total number of invoices. */
180+
totalCount: number
181+
/** Paginated returned invoices. */
182+
invoices: Invoice[]
191183
}

0 commit comments

Comments
 (0)