@scaleway/sdk-billing 2.2.0 → 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 +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/index.gen.js +2 -4
- package/dist/v2beta1/api.gen.js +113 -190
- package/dist/v2beta1/index.gen.d.ts +1 -1
- package/dist/v2beta1/index.gen.js +12 -10
- package/dist/v2beta1/marshalling.gen.js +91 -143
- package/package.json +4 -4
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
package/dist/v2beta1/api.gen.js
CHANGED
|
@@ -1,191 +1,114 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
["page_size", request.pageSize ?? this.client.settings.defaultPageSize]
|
|
114
|
-
),
|
|
115
|
-
responseType: "blob"
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* Get an invoice. Get a specific invoice, specified by its ID.
|
|
119
|
-
*
|
|
120
|
-
* @param request - The request {@link GetInvoiceRequest}
|
|
121
|
-
* @returns A Promise of Invoice
|
|
122
|
-
*/
|
|
123
|
-
getInvoice = (request) => this.client.fetch(
|
|
124
|
-
{
|
|
125
|
-
method: "GET",
|
|
126
|
-
path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}`
|
|
127
|
-
},
|
|
128
|
-
unmarshalInvoice
|
|
129
|
-
);
|
|
130
|
-
/**
|
|
131
|
-
* Download an invoice. Download a specific invoice, specified by its ID.
|
|
132
|
-
*
|
|
133
|
-
* @param request - The request {@link DownloadInvoiceRequest}
|
|
134
|
-
* @returns A Promise of Blob
|
|
135
|
-
*/
|
|
136
|
-
downloadInvoice = (request) => this.client.fetch({
|
|
137
|
-
method: "GET",
|
|
138
|
-
path: `/billing/v2beta1/invoices/${validatePathParam("invoiceId", request.invoiceId)}/download`,
|
|
139
|
-
urlParams: urlParams(["dl", 1], ["file_type", request.fileType]),
|
|
140
|
-
responseType: "blob"
|
|
141
|
-
});
|
|
142
|
-
pageOfListDiscounts = (request = {}) => this.client.fetch(
|
|
143
|
-
{
|
|
144
|
-
method: "GET",
|
|
145
|
-
path: `/billing/v2beta1/discounts`,
|
|
146
|
-
urlParams: urlParams(
|
|
147
|
-
["order_by", request.orderBy],
|
|
148
|
-
["organization_id", request.organizationId],
|
|
149
|
-
["page", request.page],
|
|
150
|
-
[
|
|
151
|
-
"page_size",
|
|
152
|
-
request.pageSize ?? this.client.settings.defaultPageSize
|
|
153
|
-
]
|
|
154
|
-
)
|
|
155
|
-
},
|
|
156
|
-
unmarshalListDiscountsResponse
|
|
157
|
-
);
|
|
158
|
-
/**
|
|
159
|
-
* 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:
|
|
160
|
-
- If you do not specify an `organization_id` you will list the discounts applied to your own Organization and your customers
|
|
161
|
-
- If you indicate your `organization_id` you will list only the discounts applied to your Organization
|
|
162
|
-
- If you indicate `the organization_id` of one of your customers, you will list the discounts applied to their Organization.
|
|
163
|
-
*
|
|
164
|
-
* @param request - The request {@link ListDiscountsRequest}
|
|
165
|
-
* @returns A Promise of ListDiscountsResponse
|
|
166
|
-
*/
|
|
167
|
-
listDiscounts = (request = {}) => enrichForPagination("discounts", this.pageOfListDiscounts, request);
|
|
168
|
-
/**
|
|
169
|
-
* Redeem coupon. Redeem a coupon given the related code.
|
|
170
|
-
*
|
|
171
|
-
* @param request - The request {@link RedeemCouponRequest}
|
|
172
|
-
* @returns A Promise of Discount
|
|
173
|
-
*/
|
|
174
|
-
redeemCoupon = (request) => this.client.fetch(
|
|
175
|
-
{
|
|
176
|
-
method: "POST",
|
|
177
|
-
path: `/billing/v2beta1/redeem-coupon`,
|
|
178
|
-
urlParams: urlParams(
|
|
179
|
-
["code", request.code],
|
|
180
|
-
[
|
|
181
|
-
"organization_id",
|
|
182
|
-
request.organizationId ?? this.client.settings.defaultOrganizationId
|
|
183
|
-
]
|
|
184
|
-
)
|
|
185
|
-
},
|
|
186
|
-
unmarshalDiscount
|
|
187
|
-
);
|
|
188
|
-
}
|
|
189
|
-
export {
|
|
190
|
-
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);
|
|
191
113
|
};
|
|
114
|
+
export { API$1 as API };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { API } from './api.gen.js';
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
2
|
export * from './marshalling.gen.js';
|
|
3
3
|
export type { Discount, DiscountCoupon, DiscountDiscountMode, DiscountFilter, DiscountFilterType, DownloadInvoiceRequest, DownloadInvoiceRequestFileType, ExportInvoicesRequest, ExportInvoicesRequestFileType, ExportInvoicesRequestOrderBy, GetInvoiceRequest, Invoice, InvoiceType, ListConsumptionsRequest, ListConsumptionsRequestOrderBy, ListConsumptionsResponse, ListConsumptionsResponseConsumption, ListDiscountsRequest, ListDiscountsRequestOrderBy, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesRequestOrderBy, ListInvoicesResponse, ListTaxesRequest, ListTaxesRequestOrderBy, ListTaxesResponse, ListTaxesResponseTax, RedeemCouponRequest, } from './types.gen.js';
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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,159 +1,107 @@
|
|
|
1
|
-
import { isJSONObject,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
data.consumptions,
|
|
98
|
-
unmarshalListConsumptionsResponseConsumption
|
|
99
|
-
),
|
|
100
|
-
totalCount: data.total_count,
|
|
101
|
-
totalDiscountUntaxedValue: data.total_discount_untaxed_value,
|
|
102
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
103
|
-
};
|
|
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
|
+
};
|
|
104
75
|
};
|
|
105
76
|
const unmarshalListDiscountsResponse = (data) => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
|
|
113
|
-
totalCount: data.total_count
|
|
114
|
-
};
|
|
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
|
+
};
|
|
115
82
|
};
|
|
116
83
|
const unmarshalListInvoicesResponse = (data) => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return {
|
|
123
|
-
invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
|
|
124
|
-
totalCount: data.total_count
|
|
125
|
-
};
|
|
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
|
+
};
|
|
126
89
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
description: data.description,
|
|
136
|
-
rate: data.rate,
|
|
137
|
-
totalTaxValue: data.total_tax_value
|
|
138
|
-
};
|
|
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
|
+
};
|
|
139
98
|
};
|
|
140
99
|
const unmarshalListTaxesResponse = (data) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
|
|
148
|
-
totalCount: data.total_count,
|
|
149
|
-
updatedAt: unmarshalDate(data.updated_at)
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
export {
|
|
153
|
-
unmarshalDiscount,
|
|
154
|
-
unmarshalInvoice,
|
|
155
|
-
unmarshalListConsumptionsResponse,
|
|
156
|
-
unmarshalListDiscountsResponse,
|
|
157
|
-
unmarshalListInvoicesResponse,
|
|
158
|
-
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
|
+
};
|
|
159
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.
|
|
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.
|
|
30
|
+
"@scaleway/sdk-std": "2.2.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@scaleway/sdk-client": "^2.
|
|
33
|
+
"@scaleway/sdk-client": "^2.2.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^2.
|
|
36
|
+
"@scaleway/sdk-client": "^2.2.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"package:check": "pnpm publint",
|