@scaleway/sdk-billing 2.7.1 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,220 +0,0 @@
1
- import type { Money } from '@scaleway/sdk-client';
2
- export type BudgetAlertNotificationType = 'unknown_type' | 'sms' | 'email' | 'webhook';
3
- export interface BudgetAlertNotification {
4
- /**
5
- * Alert notification's ID.
6
- */
7
- id: string;
8
- /**
9
- * The creation date of the alert notification.
10
- */
11
- createdAt?: Date;
12
- /**
13
- * The last modification date of the alert notification.
14
- */
15
- updatedAt?: Date;
16
- /**
17
- * Kind of notification.
18
- */
19
- type: BudgetAlertNotificationType;
20
- /**
21
- * List of recipients for this alert.
22
- */
23
- recipients: string[];
24
- }
25
- export interface BudgetAlert {
26
- /**
27
- * Alert's ID.
28
- */
29
- id: string;
30
- /**
31
- * The creation date of the alert.
32
- */
33
- createdAt?: Date;
34
- /**
35
- * The last modification date of the alert.
36
- */
37
- updatedAt?: Date;
38
- /**
39
- * Percentage threshold of the budget's limit for which the alert is triggered.
40
- */
41
- threshold: number;
42
- /**
43
- * Notifications to send when the alert is triggered.
44
- */
45
- notifications: BudgetAlertNotification[];
46
- }
47
- export interface Budget {
48
- /**
49
- * Budget's ID.
50
- */
51
- id: string;
52
- /**
53
- * The creation date of the budget.
54
- */
55
- createdAt?: Date;
56
- /**
57
- * The last modification date of the budget.
58
- */
59
- updatedAt?: Date;
60
- /**
61
- * The organization ID of the budget.
62
- */
63
- organizationId: string;
64
- /**
65
- * Whether the budget is enabled or not.
66
- */
67
- enabled: boolean;
68
- /**
69
- * Cost limit for this budget.
70
- */
71
- consumptionLimit?: Money;
72
- /**
73
- * Alerts defined for this budget.
74
- */
75
- alerts: BudgetAlert[];
76
- }
77
- export type CreateBudgetAlertNotificationRequest = {
78
- /**
79
- * The ID of the budget alert to create notification for.
80
- */
81
- budgetAlertId: string;
82
- /**
83
- * List of phone numbers to receive sms notifications.
84
- *
85
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
86
- */
87
- smsPhoneNumbers?: string[];
88
- /**
89
- * List of email addresses to receive email notifications.
90
- *
91
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
92
- */
93
- emailAddresses?: string[];
94
- /**
95
- * List of webhook url to receive webhook notifications.
96
- *
97
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
98
- */
99
- webhookUrls?: string[];
100
- };
101
- export type CreateBudgetAlertRequest = {
102
- /**
103
- * The ID of the budget to create alert for.
104
- */
105
- budgetId: string;
106
- /**
107
- * Threshold above which the alert is sent.
108
- */
109
- threshold: number;
110
- };
111
- export type CreateBudgetRequest = {
112
- /**
113
- * The Organization ID of the budget.
114
- */
115
- organizationId?: string;
116
- /**
117
- * Cost limit for the budget.
118
- */
119
- consumptionLimit: number;
120
- /**
121
- * Whether the budget is enabled or not.
122
- */
123
- enabled: boolean;
124
- };
125
- export type DeleteBudgetAlertNotificationRequest = {
126
- /**
127
- * The ID of the budget alert notification to delete.
128
- */
129
- budgetAlertNotificationId: string;
130
- };
131
- export type DeleteBudgetAlertRequest = {
132
- /**
133
- * The ID of the budget alert to delete.
134
- */
135
- budgetAlertId: string;
136
- };
137
- export type DeleteBudgetRequest = {
138
- /**
139
- * The ID of the budget to delete.
140
- */
141
- budgetId: string;
142
- };
143
- export type GetBudgetRequest = {
144
- /**
145
- * The ID of the budget.
146
- */
147
- budgetId: string;
148
- };
149
- export type ListBudgetsRequest = {
150
- /**
151
- * Filter by organization ID.
152
- */
153
- organizationId?: string;
154
- /**
155
- * Page number.
156
- */
157
- page?: number;
158
- /**
159
- * Positive integer to select the number of items to return.
160
- */
161
- pageSize?: number;
162
- };
163
- export interface ListBudgetsResponse {
164
- /**
165
- * Detailed budget list.
166
- */
167
- budgets: Budget[];
168
- /**
169
- * Total number of items.
170
- */
171
- totalCount: number;
172
- }
173
- export type UpdateBudgetAlertNotificationRequest = {
174
- /**
175
- * The ID of the budget alert notification to update.
176
- */
177
- budgetAlertNotificationId: string;
178
- /**
179
- * List of phone numbers to receive sms notifications.
180
- *
181
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
182
- */
183
- smsPhoneNumbers?: string[];
184
- /**
185
- * List of email addresses to receive email notifications.
186
- *
187
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
188
- */
189
- emailAddresses?: string[];
190
- /**
191
- * List of webhook url to receive webhook notifications.
192
- *
193
- * One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
194
- */
195
- webhookUrls?: string[];
196
- };
197
- export type UpdateBudgetAlertRequest = {
198
- /**
199
- * The ID of the budget alert to update.
200
- */
201
- budgetAlertId: string;
202
- /**
203
- * Threshold above which the alert is sent.
204
- */
205
- threshold: number;
206
- };
207
- export type UpdateBudgetRequest = {
208
- /**
209
- * The ID of the budget to update.
210
- */
211
- budgetId: string;
212
- /**
213
- * Cost limit for the budget.
214
- */
215
- consumptionLimit?: number;
216
- /**
217
- * Whether the budget will be enabled or not.
218
- */
219
- enabled?: boolean;
220
- };
File without changes
@@ -1,12 +0,0 @@
1
- export declare const CreateBudgetAlertRequest: {
2
- threshold: {
3
- greaterThanOrEqual: number;
4
- lessThanOrEqual: number;
5
- };
6
- };
7
- export declare const UpdateBudgetAlertRequest: {
8
- threshold: {
9
- greaterThanOrEqual: number;
10
- lessThanOrEqual: number;
11
- };
12
- };
@@ -1,16 +0,0 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- //#region src/v2/validation-rules.gen.ts
3
- var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({
4
- CreateBudgetAlertRequest: () => CreateBudgetAlertRequest,
5
- UpdateBudgetAlertRequest: () => UpdateBudgetAlertRequest
6
- });
7
- const CreateBudgetAlertRequest = { threshold: {
8
- greaterThanOrEqual: 1,
9
- lessThanOrEqual: 100
10
- } };
11
- const UpdateBudgetAlertRequest = { threshold: {
12
- greaterThanOrEqual: 1,
13
- lessThanOrEqual: 100
14
- } };
15
- //#endregion
16
- export { CreateBudgetAlertRequest, UpdateBudgetAlertRequest, validation_rules_gen_exports };
@@ -1,96 +0,0 @@
1
- import { API as ParentAPI } from '@scaleway/sdk-client';
2
- import type { Discount, DownloadInvoiceRequest, ExportInvoicesRequest, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsResponse, ListDiscountsRequest, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesResponse, ListTaxesRequest, ListTaxesResponse, RedeemCouponRequest } from './types.gen.js';
3
- /**
4
- * Billing API.
5
-
6
- This API allows you to manage and query your Scaleway billing and consumption.
7
- */
8
- export declare class API extends ParentAPI {
9
- protected pageOfListConsumptions: (request?: Readonly<ListConsumptionsRequest>) => Promise<ListConsumptionsResponse>;
10
- /**
11
- * Get monthly consumption. Consumption allows you to retrieve your past or current consumption cost, by project or category.
12
- *
13
- * @param request - The request {@link ListConsumptionsRequest}
14
- * @returns A Promise of ListConsumptionsResponse
15
- */
16
- listConsumptions: (request?: Readonly<ListConsumptionsRequest>) => Promise<ListConsumptionsResponse> & {
17
- all: () => Promise<import("./types.gen.js").ListConsumptionsResponseConsumption[]>;
18
- [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen.js").ListConsumptionsResponseConsumption[], void, void>;
19
- };
20
- protected pageOfListTaxes: (request?: Readonly<ListTaxesRequest>) => Promise<ListTaxesResponse>;
21
- /**
22
- * Get monthly consumption taxes. Consumption Tax allows you to retrieve your past or current tax charges, by project or category.
23
- *
24
- * @param request - The request {@link ListTaxesRequest}
25
- * @returns A Promise of ListTaxesResponse
26
- */
27
- listTaxes: (request?: Readonly<ListTaxesRequest>) => Promise<ListTaxesResponse> & {
28
- all: () => Promise<import("./types.gen.js").ListTaxesResponseTax[]>;
29
- [Symbol.asyncIterator]: () => AsyncGenerator<import("./types.gen.js").ListTaxesResponseTax[], void, void>;
30
- };
31
- protected pageOfListInvoices: (request?: Readonly<ListInvoicesRequest>) => Promise<ListInvoicesResponse>;
32
- /**
33
- * List invoices. List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID.
34
- *
35
- * @param request - The request {@link ListInvoicesRequest}
36
- * @returns A Promise of ListInvoicesResponse
37
- */
38
- listInvoices: (request?: Readonly<ListInvoicesRequest>) => Promise<ListInvoicesResponse> & {
39
- all: () => Promise<Invoice[]>;
40
- [Symbol.asyncIterator]: () => AsyncGenerator<Invoice[], void, void>;
41
- };
42
- /**
43
- * Export invoices. Export invoices in a CSV file.
44
- *
45
- * @param request - The request {@link ExportInvoicesRequest}
46
- * @returns A Promise of Blob
47
- */
48
- exportInvoices: (request?: Readonly<ExportInvoicesRequest>) => Promise<Blob>;
49
- /**
50
- * Get an invoice. Get a specific invoice, specified by its ID.
51
- *
52
- * @param request - The request {@link GetInvoiceRequest}
53
- * @returns A Promise of Invoice
54
- */
55
- getInvoice: (request: Readonly<GetInvoiceRequest>) => Promise<Invoice>;
56
- /**
57
- * Download an invoice. Download a specific invoice, specified by its ID.
58
- *
59
- * @param request - The request {@link DownloadInvoiceRequest}
60
- * @returns A Promise of Blob
61
- */
62
- downloadInvoice: (request: Readonly<DownloadInvoiceRequest>) => Promise<Blob>;
63
- protected pageOfListDiscounts: (request?: Readonly<ListDiscountsRequest>) => Promise<ListDiscountsResponse>;
64
- /**
65
- * List discounts. List all discounts for your Organization and usable categories, products, offers, references, regions and zones where the discount can be applied. As a reseller:
66
- - If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers
67
- - If you indicate your `organization_id` you will list only the discounts applied to your Organization
68
- - If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization.
69
- *
70
- * @param request - The request {@link ListDiscountsRequest}
71
- * @returns A Promise of ListDiscountsResponse
72
- */
73
- listDiscounts: (request?: Readonly<ListDiscountsRequest>) => Promise<ListDiscountsResponse> & {
74
- all: () => Promise<Discount[]>;
75
- [Symbol.asyncIterator]: () => AsyncGenerator<Discount[], void, void>;
76
- };
77
- /**
78
- * Redeem coupon. Redeem a coupon given the related code.
79
- *
80
- * @param request - The request {@link RedeemCouponRequest}
81
- * @returns A Promise of Discount
82
- */
83
- redeemCoupon: (request: Readonly<RedeemCouponRequest>) => Promise<Discount>;
84
- }
85
- /**
86
- * Billing FinOps API.
87
- */
88
- export declare class FinOpsAPI extends ParentAPI {
89
- /**
90
- * List charges. List charges for organizations or projects. You must specify at least `organization_ids` or `project_ids`.
91
- *
92
- * @param request - The request {@link FinOpsApiListChargesRequest}
93
- * @returns A Promise of ListChargesResponse
94
- */
95
- listCharges: (request?: Readonly<FinOpsApiListChargesRequest>) => Promise<ListChargesResponse>;
96
- }
@@ -1,81 +0,0 @@
1
- import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
2
- import { API as API$1, enrichForPagination, resolveOneOf, urlParams, validatePathParam } from "@scaleway/sdk-client";
3
- //#region src/v2beta1/api.gen.ts
4
- /**
5
- * Billing API.
6
-
7
- This API allows you to manage and query your Scaleway billing and consumption.
8
- */
9
- var API = class extends API$1 {
10
- constructor(..._args) {
11
- super(..._args);
12
- this.pageOfListConsumptions = (request = {}) => this.client.fetch({
13
- method: "GET",
14
- path: `/billing/v2beta1/consumptions`,
15
- urlParams: urlParams(["billing_period", request.billingPeriod], ["category_name", request.categoryName], ["order_by", request.orderBy], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ...Object.entries(resolveOneOf([{
16
- default: this.client.settings.defaultOrganizationId,
17
- param: "organization_id",
18
- value: request.organizationId
19
- }, {
20
- default: this.client.settings.defaultProjectId,
21
- param: "project_id",
22
- value: request.projectId
23
- }])))
24
- }, unmarshalListConsumptionsResponse);
25
- this.listConsumptions = (request = {}) => enrichForPagination("consumptions", this.pageOfListConsumptions, request);
26
- this.pageOfListTaxes = (request = {}) => this.client.fetch({
27
- method: "GET",
28
- path: `/billing/v2beta1/taxes`,
29
- urlParams: urlParams(["billing_period", request.billingPeriod], ["order_by", request.orderBy], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
30
- }, unmarshalListTaxesResponse);
31
- this.listTaxes = (request = {}) => enrichForPagination("taxes", this.pageOfListTaxes, request);
32
- this.pageOfListInvoices = (request = {}) => this.client.fetch({
33
- method: "GET",
34
- path: `/billing/v2beta1/invoices`,
35
- urlParams: urlParams(["billing_period_start_after", request.billingPeriodStartAfter], ["billing_period_start_before", request.billingPeriodStartBefore], ["invoice_type", request.invoiceType], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
36
- }, unmarshalListInvoicesResponse);
37
- this.listInvoices = (request = {}) => enrichForPagination("invoices", this.pageOfListInvoices, request);
38
- this.exportInvoices = (request = {}) => this.client.fetch({
39
- method: "GET",
40
- path: `/billing/v2beta1/export-invoices`,
41
- urlParams: urlParams(["dl", 1], ["billing_period_start_after", request.billingPeriodStartAfter], ["billing_period_start_before", request.billingPeriodStartBefore], ["file_type", request.fileType], ["invoice_type", request.invoiceType], ["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]),
42
- responseType: "blob"
43
- });
44
- this.getInvoice = (request) => this.client.fetch({
45
- method: "GET",
46
- path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}`
47
- }, unmarshalInvoice);
48
- this.downloadInvoice = (request) => this.client.fetch({
49
- method: "GET",
50
- path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/download`,
51
- urlParams: urlParams(["dl", 1], ["file_type", request.fileType]),
52
- responseType: "blob"
53
- });
54
- this.pageOfListDiscounts = (request = {}) => this.client.fetch({
55
- method: "GET",
56
- path: `/billing/v2beta1/discounts`,
57
- urlParams: urlParams(["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
58
- }, unmarshalListDiscountsResponse);
59
- this.listDiscounts = (request = {}) => enrichForPagination("discounts", this.pageOfListDiscounts, request);
60
- this.redeemCoupon = (request) => this.client.fetch({
61
- method: "POST",
62
- path: `/billing/v2beta1/redeem-coupon`,
63
- urlParams: urlParams(["code", request.code], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId])
64
- }, unmarshalDiscount);
65
- }
66
- };
67
- /**
68
- * Billing FinOps API.
69
- */
70
- var FinOpsAPI = class extends API$1 {
71
- constructor(..._args2) {
72
- super(..._args2);
73
- this.listCharges = (request = {}) => this.client.fetch({
74
- method: "GET",
75
- path: `/billing/v2beta1/charges`,
76
- urlParams: urlParams(["clamp_to_time_range", request.clampToTimeRange], ["end_date_before", request.endDateBefore], ["invoice_ids", request.invoiceIds], ["order_by", request.orderBy], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize], ["page_token", request.pageToken], ["project_ids", request.projectIds], ["resource_ids", request.resourceIds], ["resource_names", request.resourceNames], ["skus", request.skus], ["start_date_after", request.startDateAfter])
77
- }, unmarshalListChargesResponse);
78
- }
79
- };
80
- //#endregion
81
- export { API, FinOpsAPI };
@@ -1,4 +0,0 @@
1
- export { API, FinOpsAPI, } from './api.gen.js';
2
- export * from './marshalling.gen.js';
3
- export type { Charge, Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, InvoiceType, ListChargesRequestOrderBy, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest, } from './types.gen.js';
4
- export * as ValidationRules from './validation-rules.gen.js';
@@ -1,19 +0,0 @@
1
- import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
- import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
3
- import { API, FinOpsAPI } from "./api.gen.js";
4
- import { validation_rules_gen_exports } from "./validation-rules.gen.js";
5
- //#region src/v2beta1/index.gen.ts
6
- var index_gen_exports = /* @__PURE__ */ __exportAll({
7
- API: () => API,
8
- FinOpsAPI: () => FinOpsAPI,
9
- ValidationRules: () => validation_rules_gen_exports,
10
- unmarshalDiscount: () => unmarshalDiscount,
11
- unmarshalInvoice: () => unmarshalInvoice,
12
- unmarshalListChargesResponse: () => unmarshalListChargesResponse,
13
- unmarshalListConsumptionsResponse: () => unmarshalListConsumptionsResponse,
14
- unmarshalListDiscountsResponse: () => unmarshalListDiscountsResponse,
15
- unmarshalListInvoicesResponse: () => unmarshalListInvoicesResponse,
16
- unmarshalListTaxesResponse: () => unmarshalListTaxesResponse
17
- });
18
- //#endregion
19
- export { API, FinOpsAPI, validation_rules_gen_exports as ValidationRules, index_gen_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -1,8 +0,0 @@
1
- import type { Discount, Invoice, ListChargesResponse, ListConsumptionsResponse, ListDiscountsResponse, ListInvoicesResponse, ListTaxesResponse } from './types.gen.js';
2
- export declare const unmarshalDiscount: (data: unknown) => Discount;
3
- export declare const unmarshalInvoice: (data: unknown) => Invoice;
4
- export declare const unmarshalListChargesResponse: (data: unknown) => ListChargesResponse;
5
- export declare const unmarshalListConsumptionsResponse: (data: unknown) => ListConsumptionsResponse;
6
- export declare const unmarshalListDiscountsResponse: (data: unknown) => ListDiscountsResponse;
7
- export declare const unmarshalListInvoicesResponse: (data: unknown) => ListInvoicesResponse;
8
- export declare const unmarshalListTaxesResponse: (data: unknown) => ListTaxesResponse;
@@ -1,131 +0,0 @@
1
- import { isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
2
- //#region src/v2beta1/marshalling.gen.ts
3
- const unmarshalDiscountCoupon = (data) => {
4
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`);
5
- return { description: data.description };
6
- };
7
- const unmarshalDiscountFilter = (data) => {
8
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`);
9
- return {
10
- exclude: data.exclude,
11
- type: data.type,
12
- value: data.value
13
- };
14
- };
15
- const unmarshalDiscount = (data) => {
16
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`);
17
- return {
18
- coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : void 0,
19
- creationDate: unmarshalDate(data.creation_date),
20
- description: data.description,
21
- filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
22
- id: data.id,
23
- mode: data.mode,
24
- organizationId: data.organization_id,
25
- startDate: unmarshalDate(data.start_date),
26
- stopDate: unmarshalDate(data.stop_date),
27
- value: data.value,
28
- valueRemaining: data.value_remaining,
29
- valueUsed: data.value_used
30
- };
31
- };
32
- const unmarshalInvoice = (data) => {
33
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`);
34
- return {
35
- billingPeriod: unmarshalDate(data.billing_period),
36
- dueDate: unmarshalDate(data.due_date),
37
- id: data.id,
38
- issuedDate: unmarshalDate(data.issued_date),
39
- number: data.number,
40
- organizationId: data.organization_id,
41
- organizationName: data.organization_name,
42
- sellerName: data.seller_name,
43
- startDate: unmarshalDate(data.start_date),
44
- state: data.state,
45
- stopDate: unmarshalDate(data.stop_date),
46
- totalDiscount: data.total_discount ? unmarshalMoney(data.total_discount) : void 0,
47
- totalTax: data.total_tax ? unmarshalMoney(data.total_tax) : void 0,
48
- totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : void 0,
49
- totalUndiscount: data.total_undiscount ? unmarshalMoney(data.total_undiscount) : void 0,
50
- totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : void 0,
51
- type: data.type
52
- };
53
- };
54
- const unmarshalCharge = (data) => {
55
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Charge' failed as data isn't a dictionary.`);
56
- return {
57
- endDate: unmarshalDate(data.end_date),
58
- invoiceId: data.invoice_id,
59
- organizationId: data.organization_id,
60
- price: data.price ? unmarshalMoney(data.price) : void 0,
61
- projectId: data.project_id,
62
- resourceId: data.resource_id,
63
- resourceName: data.resource_name,
64
- sku: data.sku,
65
- startDate: unmarshalDate(data.start_date),
66
- updatedAt: unmarshalDate(data.updated_at)
67
- };
68
- };
69
- const unmarshalListChargesResponse = (data) => {
70
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListChargesResponse' failed as data isn't a dictionary.`);
71
- return {
72
- charges: unmarshalArrayOfObject(data.charges, unmarshalCharge),
73
- nextPageToken: data.next_page_token
74
- };
75
- };
76
- const unmarshalListConsumptionsResponseConsumption = (data) => {
77
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
78
- return {
79
- billedQuantity: data.billed_quantity,
80
- categoryName: data.category_name,
81
- consumerId: data.consumer_id,
82
- productName: data.product_name,
83
- projectId: data.project_id,
84
- resourceName: data.resource_name,
85
- sku: data.sku,
86
- unit: data.unit,
87
- value: data.value ? unmarshalMoney(data.value) : void 0
88
- };
89
- };
90
- const unmarshalListConsumptionsResponse = (data) => {
91
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`);
92
- return {
93
- consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalListConsumptionsResponseConsumption),
94
- totalCount: data.total_count,
95
- totalDiscountUntaxedValue: data.total_discount_untaxed_value,
96
- updatedAt: unmarshalDate(data.updated_at)
97
- };
98
- };
99
- const unmarshalListDiscountsResponse = (data) => {
100
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`);
101
- return {
102
- discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
103
- totalCount: data.total_count
104
- };
105
- };
106
- const unmarshalListInvoicesResponse = (data) => {
107
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
108
- return {
109
- invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
110
- totalCount: data.total_count
111
- };
112
- };
113
- const unmarshalListTaxesResponseTax = (data) => {
114
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`);
115
- return {
116
- currency: data.currency,
117
- description: data.description,
118
- rate: data.rate,
119
- totalTaxValue: data.total_tax_value
120
- };
121
- };
122
- const unmarshalListTaxesResponse = (data) => {
123
- if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`);
124
- return {
125
- taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
126
- totalCount: data.total_count,
127
- updatedAt: unmarshalDate(data.updated_at)
128
- };
129
- };
130
- //#endregion
131
- export { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -1,78 +0,0 @@
1
- export declare const queriesMetadata: {
2
- readonly namespace: 'billing';
3
- readonly version: 'v2beta1';
4
- readonly folderName: 'billingv2beta1';
5
- readonly services: readonly [{
6
- readonly apiClass: 'API';
7
- readonly methods: readonly [{
8
- readonly methodName: 'listConsumptions';
9
- readonly protoName: 'ListConsumptions';
10
- readonly paramsType: 'ListConsumptionsRequest';
11
- readonly returnType: 'ListConsumptionsResponse';
12
- readonly isList: true;
13
- readonly paginationType: 'offset';
14
- readonly pageParamKey: 'page';
15
- readonly listItemType: 'ListConsumptionsResponseConsumption';
16
- readonly isPrivate: false;
17
- readonly description: '"';
18
- }, {
19
- readonly methodName: 'listTaxes';
20
- readonly protoName: 'ListTaxes';
21
- readonly paramsType: 'ListTaxesRequest';
22
- readonly returnType: 'ListTaxesResponse';
23
- readonly isList: true;
24
- readonly paginationType: 'offset';
25
- readonly pageParamKey: 'page';
26
- readonly listItemType: 'ListTaxesResponseTax';
27
- readonly isPrivate: false;
28
- readonly description: '"';
29
- }, {
30
- readonly methodName: 'listInvoices';
31
- readonly protoName: 'ListInvoices';
32
- readonly paramsType: 'ListInvoicesRequest';
33
- readonly returnType: 'ListInvoicesResponse';
34
- readonly isList: true;
35
- readonly paginationType: 'offset';
36
- readonly pageParamKey: 'page';
37
- readonly listItemType: 'Invoice';
38
- readonly isPrivate: false;
39
- readonly description: '"';
40
- }, {
41
- readonly methodName: 'getInvoice';
42
- readonly protoName: 'GetInvoice';
43
- readonly paramsType: 'GetInvoiceRequest';
44
- readonly returnType: 'Invoice';
45
- readonly isList: false;
46
- readonly paginationType: 'none';
47
- readonly isPrivate: false;
48
- readonly description: '"';
49
- }, {
50
- readonly methodName: 'listDiscounts';
51
- readonly protoName: 'ListDiscounts';
52
- readonly paramsType: 'ListDiscountsRequest';
53
- readonly returnType: 'ListDiscountsResponse';
54
- readonly isList: true;
55
- readonly paginationType: 'offset';
56
- readonly pageParamKey: 'page';
57
- readonly listItemType: 'Discount';
58
- readonly isPrivate: false;
59
- readonly description: '"';
60
- }];
61
- }, {
62
- readonly apiClass: 'FinOpsAPI';
63
- readonly methods: readonly [{
64
- readonly methodName: 'listCharges';
65
- readonly protoName: 'ListCharges';
66
- readonly paramsType: 'FinOpsApiListChargesRequest';
67
- readonly returnType: 'ListChargesResponse';
68
- readonly isList: true;
69
- readonly paginationType: 'cursor';
70
- readonly pageParamKey: 'pageToken';
71
- readonly listItemType: 'Charge';
72
- readonly nextPageField: 'nextPageToken';
73
- readonly isPrivate: false;
74
- readonly description: '"';
75
- }];
76
- }];
77
- };
78
- export type QueriesMetadata = typeof queriesMetadata;