@scaleway/sdk-billing 2.2.1 → 2.3.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.
package/README.md CHANGED
@@ -83,6 +83,7 @@ const api = new Billing.v1.API(client)
83
83
  ## Support
84
84
 
85
85
  We love feedback! Feel free to reach us on:
86
+
86
87
  - [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
87
88
  - [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
88
89
 
@@ -93,4 +94,3 @@ This repository is at its early stage and is still in active development. If you
93
94
  ## License
94
95
 
95
96
  This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
96
-
@@ -0,0 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __exportAll = (all, no_symbols) => {
3
+ let target = {};
4
+ for (var name in all) __defProp(target, name, {
5
+ get: all[name],
6
+ enumerable: true
7
+ });
8
+ if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
9
+ return target;
10
+ };
11
+ export { __exportAll };
package/dist/index.gen.js CHANGED
@@ -1,4 +1,2 @@
1
- import * as index_gen from "./v2beta1/index.gen.js";
2
- export {
3
- index_gen as Billingv2beta1
4
- };
1
+ import { index_gen_exports } from "./v2beta1/index.gen.js";
2
+ export { index_gen_exports as Billingv2beta1 };
@@ -1,178 +1,114 @@
1
- import { API as API$1, urlParams, resolveOneOf, enrichForPagination, validatePathParam } from "@scaleway/sdk-client";
2
- import { unmarshalListConsumptionsResponse, unmarshalListTaxesResponse, unmarshalListInvoicesResponse, unmarshalInvoice, unmarshalListDiscountsResponse, unmarshalDiscount } from "./marshalling.gen.js";
3
- class API extends API$1 {
4
- pageOfListConsumptions = (request = {}) => this.client.fetch(
5
- {
6
- method: "GET",
7
- path: `/billing/v2beta1/consumptions`,
8
- urlParams: urlParams(
9
- ["billing_period", request.billingPeriod],
10
- ["category_name", request.categoryName],
11
- ["order_by", request.orderBy],
12
- ["page", request.page],
13
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize],
14
- ...Object.entries(resolveOneOf([
15
- {
16
- default: this.client.settings.defaultOrganizationId,
17
- param: "organization_id",
18
- value: request.organizationId
19
- },
20
- {
21
- default: this.client.settings.defaultProjectId,
22
- param: "project_id",
23
- value: request.projectId
24
- }
25
- ]))
26
- )
27
- },
28
- unmarshalListConsumptionsResponse
29
- );
30
- /**
31
- * Get monthly consumption. Consumption allows you to retrieve your past or current consumption cost, by project or category.
32
- *
33
- * @param request - The request {@link ListConsumptionsRequest}
34
- * @returns A Promise of ListConsumptionsResponse
35
- */
36
- listConsumptions = (request = {}) => enrichForPagination("consumptions", this.pageOfListConsumptions, request);
37
- pageOfListTaxes = (request = {}) => this.client.fetch(
38
- {
39
- method: "GET",
40
- path: `/billing/v2beta1/taxes`,
41
- urlParams: urlParams(
42
- ["billing_period", request.billingPeriod],
43
- ["order_by", request.orderBy],
44
- ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
45
- ["page", request.page],
46
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
47
- )
48
- },
49
- unmarshalListTaxesResponse
50
- );
51
- /**
52
- * Get monthly consumption taxes. Consumption Tax allows you to retrieve your past or current tax charges, by project or category.
53
- *
54
- * @param request - The request {@link ListTaxesRequest}
55
- * @returns A Promise of ListTaxesResponse
56
- */
57
- listTaxes = (request = {}) => enrichForPagination("taxes", this.pageOfListTaxes, request);
58
- pageOfListInvoices = (request = {}) => this.client.fetch(
59
- {
60
- method: "GET",
61
- path: `/billing/v2beta1/invoices`,
62
- urlParams: urlParams(
63
- ["billing_period_start_after", request.billingPeriodStartAfter],
64
- ["billing_period_start_before", request.billingPeriodStartBefore],
65
- ["invoice_type", request.invoiceType],
66
- ["order_by", request.orderBy],
67
- ["organization_id", request.organizationId],
68
- ["page", request.page],
69
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
70
- )
71
- },
72
- unmarshalListInvoicesResponse
73
- );
74
- /**
75
- * List invoices. List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID.
76
- *
77
- * @param request - The request {@link ListInvoicesRequest}
78
- * @returns A Promise of ListInvoicesResponse
79
- */
80
- listInvoices = (request = {}) => enrichForPagination("invoices", this.pageOfListInvoices, request);
81
- /**
82
- * Export invoices. Export invoices in a CSV file.
83
- *
84
- * @param request - The request {@link ExportInvoicesRequest}
85
- * @returns A Promise of Blob
86
- */
87
- exportInvoices = (request = {}) => this.client.fetch(
88
- {
89
- method: "GET",
90
- path: `/billing/v2beta1/export-invoices`,
91
- urlParams: urlParams(
92
- ["dl", 1],
93
- ["billing_period_start_after", request.billingPeriodStartAfter],
94
- ["billing_period_start_before", request.billingPeriodStartBefore],
95
- ["file_type", request.fileType],
96
- ["invoice_type", request.invoiceType],
97
- ["order_by", request.orderBy],
98
- ["organization_id", request.organizationId],
99
- ["page", request.page],
100
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
101
- ),
102
- responseType: "blob"
103
- }
104
- );
105
- /**
106
- * Get an invoice. Get a specific invoice, specified by its ID.
107
- *
108
- * @param request - The request {@link GetInvoiceRequest}
109
- * @returns A Promise of Invoice
110
- */
111
- getInvoice = (request) => this.client.fetch(
112
- {
113
- method: "GET",
114
- path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}`
115
- },
116
- unmarshalInvoice
117
- );
118
- /**
119
- * Download an invoice. Download a specific invoice, specified by its ID.
120
- *
121
- * @param request - The request {@link DownloadInvoiceRequest}
122
- * @returns A Promise of Blob
123
- */
124
- downloadInvoice = (request) => this.client.fetch(
125
- {
126
- method: "GET",
127
- path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/download`,
128
- urlParams: urlParams(
129
- ["dl", 1],
130
- ["file_type", request.fileType]
131
- ),
132
- responseType: "blob"
133
- }
134
- );
135
- pageOfListDiscounts = (request = {}) => this.client.fetch(
136
- {
137
- method: "GET",
138
- path: `/billing/v2beta1/discounts`,
139
- urlParams: urlParams(
140
- ["order_by", request.orderBy],
141
- ["organization_id", request.organizationId],
142
- ["page", request.page],
143
- ["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
144
- )
145
- },
146
- unmarshalListDiscountsResponse
147
- );
148
- /**
149
- * 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:
150
- - If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers
151
- - If you indicate your `organization_id` you will list only the discounts applied to your Organization
152
- - If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization.
153
- *
154
- * @param request - The request {@link ListDiscountsRequest}
155
- * @returns A Promise of ListDiscountsResponse
156
- */
157
- listDiscounts = (request = {}) => enrichForPagination("discounts", this.pageOfListDiscounts, request);
158
- /**
159
- * Redeem coupon. Redeem a coupon given the related code.
160
- *
161
- * @param request - The request {@link RedeemCouponRequest}
162
- * @returns A Promise of Discount
163
- */
164
- redeemCoupon = (request) => this.client.fetch(
165
- {
166
- method: "POST",
167
- path: `/billing/v2beta1/redeem-coupon`,
168
- urlParams: urlParams(
169
- ["code", request.code],
170
- ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId]
171
- )
172
- },
173
- unmarshalDiscount
174
- );
175
- }
176
- export {
177
- API
1
+ import { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
2
+ import { API, enrichForPagination, resolveOneOf, urlParams, validatePathParam } from "@scaleway/sdk-client";
3
+ /**
4
+ * Billing API.
5
+
6
+ This API allows you to manage and query your Scaleway billing and consumption.
7
+ */
8
+ var API$1 = class extends API {
9
+ pageOfListConsumptions = (request = {}) => this.client.fetch({
10
+ method: "GET",
11
+ path: `/billing/v2beta1/consumptions`,
12
+ 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([{
13
+ default: this.client.settings.defaultOrganizationId,
14
+ param: "organization_id",
15
+ value: request.organizationId
16
+ }, {
17
+ default: this.client.settings.defaultProjectId,
18
+ param: "project_id",
19
+ value: request.projectId
20
+ }])))
21
+ }, unmarshalListConsumptionsResponse);
22
+ /**
23
+ * Get monthly consumption. Consumption allows you to retrieve your past or current consumption cost, by project or category.
24
+ *
25
+ * @param request - The request {@link ListConsumptionsRequest}
26
+ * @returns A Promise of ListConsumptionsResponse
27
+ */
28
+ listConsumptions = (request = {}) => enrichForPagination("consumptions", this.pageOfListConsumptions, request);
29
+ pageOfListTaxes = (request = {}) => this.client.fetch({
30
+ method: "GET",
31
+ path: `/billing/v2beta1/taxes`,
32
+ 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])
33
+ }, unmarshalListTaxesResponse);
34
+ /**
35
+ * Get monthly consumption taxes. Consumption Tax allows you to retrieve your past or current tax charges, by project or category.
36
+ *
37
+ * @param request - The request {@link ListTaxesRequest}
38
+ * @returns A Promise of ListTaxesResponse
39
+ */
40
+ listTaxes = (request = {}) => enrichForPagination("taxes", this.pageOfListTaxes, request);
41
+ pageOfListInvoices = (request = {}) => this.client.fetch({
42
+ method: "GET",
43
+ path: `/billing/v2beta1/invoices`,
44
+ 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])
45
+ }, unmarshalListInvoicesResponse);
46
+ /**
47
+ * List invoices. List all your invoices, filtering by `start_date` and `invoice_type`. Each invoice has its own ID.
48
+ *
49
+ * @param request - The request {@link ListInvoicesRequest}
50
+ * @returns A Promise of ListInvoicesResponse
51
+ */
52
+ listInvoices = (request = {}) => enrichForPagination("invoices", this.pageOfListInvoices, request);
53
+ /**
54
+ * Export invoices. Export invoices in a CSV file.
55
+ *
56
+ * @param request - The request {@link ExportInvoicesRequest}
57
+ * @returns A Promise of Blob
58
+ */
59
+ exportInvoices = (request = {}) => this.client.fetch({
60
+ method: "GET",
61
+ path: `/billing/v2beta1/export-invoices`,
62
+ 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]),
63
+ responseType: "blob"
64
+ });
65
+ /**
66
+ * Get an invoice. Get a specific invoice, specified by its ID.
67
+ *
68
+ * @param request - The request {@link GetInvoiceRequest}
69
+ * @returns A Promise of Invoice
70
+ */
71
+ getInvoice = (request) => this.client.fetch({
72
+ method: "GET",
73
+ path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}`
74
+ }, unmarshalInvoice);
75
+ /**
76
+ * Download an invoice. Download a specific invoice, specified by its ID.
77
+ *
78
+ * @param request - The request {@link DownloadInvoiceRequest}
79
+ * @returns A Promise of Blob
80
+ */
81
+ downloadInvoice = (request) => this.client.fetch({
82
+ method: "GET",
83
+ path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/download`,
84
+ urlParams: urlParams(["dl", 1], ["file_type", request.fileType]),
85
+ responseType: "blob"
86
+ });
87
+ pageOfListDiscounts = (request = {}) => this.client.fetch({
88
+ method: "GET",
89
+ path: `/billing/v2beta1/discounts`,
90
+ urlParams: urlParams(["order_by", request.orderBy], ["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
91
+ }, unmarshalListDiscountsResponse);
92
+ /**
93
+ * 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:
94
+ - If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers
95
+ - If you indicate your `organization_id` you will list only the discounts applied to your Organization
96
+ - If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization.
97
+ *
98
+ * @param request - The request {@link ListDiscountsRequest}
99
+ * @returns A Promise of ListDiscountsResponse
100
+ */
101
+ listDiscounts = (request = {}) => enrichForPagination("discounts", this.pageOfListDiscounts, request);
102
+ /**
103
+ * Redeem coupon. Redeem a coupon given the related code.
104
+ *
105
+ * @param request - The request {@link RedeemCouponRequest}
106
+ * @returns A Promise of Discount
107
+ */
108
+ redeemCoupon = (request) => this.client.fetch({
109
+ method: "POST",
110
+ path: `/billing/v2beta1/redeem-coupon`,
111
+ urlParams: urlParams(["code", request.code], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId])
112
+ }, unmarshalDiscount);
178
113
  };
114
+ export { API$1 as API };
@@ -1,11 +1,13 @@
1
- import { API } from "./api.gen.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
3
- export {
4
- API,
5
- unmarshalDiscount,
6
- unmarshalInvoice,
7
- unmarshalListConsumptionsResponse,
8
- unmarshalListDiscountsResponse,
9
- unmarshalListInvoicesResponse,
10
- unmarshalListTaxesResponse
11
- };
3
+ import { API } from "./api.gen.js";
4
+ var index_gen_exports = /* @__PURE__ */ __exportAll({
5
+ API: () => API,
6
+ unmarshalDiscount: () => unmarshalDiscount,
7
+ unmarshalInvoice: () => unmarshalInvoice,
8
+ unmarshalListConsumptionsResponse: () => unmarshalListConsumptionsResponse,
9
+ unmarshalListDiscountsResponse: () => unmarshalListDiscountsResponse,
10
+ unmarshalListInvoicesResponse: () => unmarshalListInvoicesResponse,
11
+ unmarshalListTaxesResponse: () => unmarshalListTaxesResponse
12
+ });
13
+ export { index_gen_exports };
@@ -1,156 +1,107 @@
1
- import { isJSONObject, unmarshalDate, unmarshalArrayOfObject, unmarshalMoney } from "@scaleway/sdk-client";
2
- const unmarshalDiscountCoupon = (data) => {
3
- if (!isJSONObject(data)) {
4
- throw new TypeError(
5
- `Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`
6
- );
7
- }
8
- return {
9
- description: data.description
10
- };
1
+ import { isJSONObject, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
2
+ var unmarshalDiscountCoupon = (data) => {
3
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`);
4
+ return { description: data.description };
11
5
  };
12
- const unmarshalDiscountFilter = (data) => {
13
- if (!isJSONObject(data)) {
14
- throw new TypeError(
15
- `Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`
16
- );
17
- }
18
- return {
19
- exclude: data.exclude,
20
- type: data.type,
21
- value: data.value
22
- };
6
+ var unmarshalDiscountFilter = (data) => {
7
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`);
8
+ return {
9
+ exclude: data.exclude,
10
+ type: data.type,
11
+ value: data.value
12
+ };
23
13
  };
24
14
  const unmarshalDiscount = (data) => {
25
- if (!isJSONObject(data)) {
26
- throw new TypeError(
27
- `Unmarshalling the type 'Discount' failed as data isn't a dictionary.`
28
- );
29
- }
30
- return {
31
- coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : void 0,
32
- creationDate: unmarshalDate(data.creation_date),
33
- description: data.description,
34
- filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
35
- id: data.id,
36
- mode: data.mode,
37
- organizationId: data.organization_id,
38
- startDate: unmarshalDate(data.start_date),
39
- stopDate: unmarshalDate(data.stop_date),
40
- value: data.value,
41
- valueRemaining: data.value_remaining,
42
- valueUsed: data.value_used
43
- };
15
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`);
16
+ return {
17
+ coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : void 0,
18
+ creationDate: unmarshalDate(data.creation_date),
19
+ description: data.description,
20
+ filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
21
+ id: data.id,
22
+ mode: data.mode,
23
+ organizationId: data.organization_id,
24
+ startDate: unmarshalDate(data.start_date),
25
+ stopDate: unmarshalDate(data.stop_date),
26
+ value: data.value,
27
+ valueRemaining: data.value_remaining,
28
+ valueUsed: data.value_used
29
+ };
44
30
  };
45
31
  const unmarshalInvoice = (data) => {
46
- if (!isJSONObject(data)) {
47
- throw new TypeError(
48
- `Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`
49
- );
50
- }
51
- return {
52
- billingPeriod: unmarshalDate(data.billing_period),
53
- dueDate: unmarshalDate(data.due_date),
54
- id: data.id,
55
- issuedDate: unmarshalDate(data.issued_date),
56
- number: data.number,
57
- organizationId: data.organization_id,
58
- organizationName: data.organization_name,
59
- sellerName: data.seller_name,
60
- startDate: unmarshalDate(data.start_date),
61
- state: data.state,
62
- stopDate: unmarshalDate(data.stop_date),
63
- totalDiscount: data.total_discount ? unmarshalMoney(data.total_discount) : void 0,
64
- totalTax: data.total_tax ? unmarshalMoney(data.total_tax) : void 0,
65
- totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : void 0,
66
- totalUndiscount: data.total_undiscount ? unmarshalMoney(data.total_undiscount) : void 0,
67
- totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : void 0,
68
- type: data.type
69
- };
32
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`);
33
+ return {
34
+ billingPeriod: unmarshalDate(data.billing_period),
35
+ dueDate: unmarshalDate(data.due_date),
36
+ id: data.id,
37
+ issuedDate: unmarshalDate(data.issued_date),
38
+ number: data.number,
39
+ organizationId: data.organization_id,
40
+ organizationName: data.organization_name,
41
+ sellerName: data.seller_name,
42
+ startDate: unmarshalDate(data.start_date),
43
+ state: data.state,
44
+ stopDate: unmarshalDate(data.stop_date),
45
+ totalDiscount: data.total_discount ? unmarshalMoney(data.total_discount) : void 0,
46
+ totalTax: data.total_tax ? unmarshalMoney(data.total_tax) : void 0,
47
+ totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : void 0,
48
+ totalUndiscount: data.total_undiscount ? unmarshalMoney(data.total_undiscount) : void 0,
49
+ totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : void 0,
50
+ type: data.type
51
+ };
70
52
  };
71
- const unmarshalListConsumptionsResponseConsumption = (data) => {
72
- if (!isJSONObject(data)) {
73
- throw new TypeError(
74
- `Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`
75
- );
76
- }
77
- return {
78
- billedQuantity: data.billed_quantity,
79
- categoryName: data.category_name,
80
- consumerId: data.consumer_id,
81
- productName: data.product_name,
82
- projectId: data.project_id,
83
- resourceName: data.resource_name,
84
- sku: data.sku,
85
- unit: data.unit,
86
- value: data.value ? unmarshalMoney(data.value) : void 0
87
- };
53
+ var unmarshalListConsumptionsResponseConsumption = (data) => {
54
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
55
+ return {
56
+ billedQuantity: data.billed_quantity,
57
+ categoryName: data.category_name,
58
+ consumerId: data.consumer_id,
59
+ productName: data.product_name,
60
+ projectId: data.project_id,
61
+ resourceName: data.resource_name,
62
+ sku: data.sku,
63
+ unit: data.unit,
64
+ value: data.value ? unmarshalMoney(data.value) : void 0
65
+ };
88
66
  };
89
67
  const unmarshalListConsumptionsResponse = (data) => {
90
- if (!isJSONObject(data)) {
91
- throw new TypeError(
92
- `Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`
93
- );
94
- }
95
- return {
96
- consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalListConsumptionsResponseConsumption),
97
- totalCount: data.total_count,
98
- totalDiscountUntaxedValue: data.total_discount_untaxed_value,
99
- updatedAt: unmarshalDate(data.updated_at)
100
- };
68
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`);
69
+ return {
70
+ consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalListConsumptionsResponseConsumption),
71
+ totalCount: data.total_count,
72
+ totalDiscountUntaxedValue: data.total_discount_untaxed_value,
73
+ updatedAt: unmarshalDate(data.updated_at)
74
+ };
101
75
  };
102
76
  const unmarshalListDiscountsResponse = (data) => {
103
- if (!isJSONObject(data)) {
104
- throw new TypeError(
105
- `Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`
106
- );
107
- }
108
- return {
109
- discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
110
- totalCount: data.total_count
111
- };
77
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`);
78
+ return {
79
+ discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
80
+ totalCount: data.total_count
81
+ };
112
82
  };
113
83
  const unmarshalListInvoicesResponse = (data) => {
114
- if (!isJSONObject(data)) {
115
- throw new TypeError(
116
- `Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`
117
- );
118
- }
119
- return {
120
- invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
121
- totalCount: data.total_count
122
- };
84
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
85
+ return {
86
+ invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
87
+ totalCount: data.total_count
88
+ };
123
89
  };
124
- const unmarshalListTaxesResponseTax = (data) => {
125
- if (!isJSONObject(data)) {
126
- throw new TypeError(
127
- `Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`
128
- );
129
- }
130
- return {
131
- currency: data.currency,
132
- description: data.description,
133
- rate: data.rate,
134
- totalTaxValue: data.total_tax_value
135
- };
90
+ var unmarshalListTaxesResponseTax = (data) => {
91
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`);
92
+ return {
93
+ currency: data.currency,
94
+ description: data.description,
95
+ rate: data.rate,
96
+ totalTaxValue: data.total_tax_value
97
+ };
136
98
  };
137
99
  const unmarshalListTaxesResponse = (data) => {
138
- if (!isJSONObject(data)) {
139
- throw new TypeError(
140
- `Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`
141
- );
142
- }
143
- return {
144
- taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
145
- totalCount: data.total_count,
146
- updatedAt: unmarshalDate(data.updated_at)
147
- };
148
- };
149
- export {
150
- unmarshalDiscount,
151
- unmarshalInvoice,
152
- unmarshalListConsumptionsResponse,
153
- unmarshalListDiscountsResponse,
154
- unmarshalListInvoicesResponse,
155
- unmarshalListTaxesResponse
100
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`);
101
+ return {
102
+ taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
103
+ totalCount: data.total_count,
104
+ updatedAt: unmarshalDate(data.updated_at)
105
+ };
156
106
  };
107
+ export { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/sdk-billing",
3
- "version": "2.2.1",
3
+ "version": "2.3.0",
4
4
  "description": "Scaleway SDK billing",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -27,13 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@scaleway/random-name": "5.1.2",
30
- "@scaleway/sdk-std": "2.1.1"
30
+ "@scaleway/sdk-std": "2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.0"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",