@scaleway/sdk-billing 1.0.1
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/LICENSE +191 -0
- package/dist/index.gen.cjs +4 -0
- package/dist/index.gen.d.ts +5 -0
- package/dist/index.gen.js +4 -0
- package/dist/v2beta1/api.gen.cjs +171 -0
- package/dist/v2beta1/api.gen.d.ts +77 -0
- package/dist/v2beta1/api.gen.js +171 -0
- package/dist/v2beta1/index.gen.cjs +10 -0
- package/dist/v2beta1/index.gen.d.ts +3 -0
- package/dist/v2beta1/index.gen.js +10 -0
- package/dist/v2beta1/marshalling.gen.cjs +157 -0
- package/dist/v2beta1/marshalling.gen.d.ts +6 -0
- package/dist/v2beta1/marshalling.gen.js +157 -0
- package/dist/v2beta1/types.gen.d.ts +400 -0
- package/package.json +51 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const sdkClient = require("@scaleway/sdk-client");
|
|
4
|
+
const unmarshalInvoice = (data) => {
|
|
5
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
6
|
+
throw new TypeError(
|
|
7
|
+
`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
billingPeriod: sdkClient.unmarshalDate(data.billing_period),
|
|
12
|
+
dueDate: sdkClient.unmarshalDate(data.due_date),
|
|
13
|
+
id: data.id,
|
|
14
|
+
issuedDate: sdkClient.unmarshalDate(data.issued_date),
|
|
15
|
+
number: data.number,
|
|
16
|
+
organizationId: data.organization_id,
|
|
17
|
+
organizationName: data.organization_name,
|
|
18
|
+
sellerName: data.seller_name,
|
|
19
|
+
startDate: sdkClient.unmarshalDate(data.start_date),
|
|
20
|
+
state: data.state,
|
|
21
|
+
stopDate: sdkClient.unmarshalDate(data.stop_date),
|
|
22
|
+
totalDiscount: data.total_discount ? sdkClient.unmarshalMoney(data.total_discount) : void 0,
|
|
23
|
+
totalTax: data.total_tax ? sdkClient.unmarshalMoney(data.total_tax) : void 0,
|
|
24
|
+
totalTaxed: data.total_taxed ? sdkClient.unmarshalMoney(data.total_taxed) : void 0,
|
|
25
|
+
totalUndiscount: data.total_undiscount ? sdkClient.unmarshalMoney(data.total_undiscount) : void 0,
|
|
26
|
+
totalUntaxed: data.total_untaxed ? sdkClient.unmarshalMoney(data.total_untaxed) : void 0,
|
|
27
|
+
type: data.type
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
const unmarshalListConsumptionsResponseConsumption = (data) => {
|
|
31
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
32
|
+
throw new TypeError(
|
|
33
|
+
`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
billedQuantity: data.billed_quantity,
|
|
38
|
+
categoryName: data.category_name,
|
|
39
|
+
productName: data.product_name,
|
|
40
|
+
projectId: data.project_id,
|
|
41
|
+
resourceName: data.resource_name,
|
|
42
|
+
sku: data.sku,
|
|
43
|
+
unit: data.unit,
|
|
44
|
+
value: data.value ? sdkClient.unmarshalMoney(data.value) : void 0
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
const unmarshalListConsumptionsResponse = (data) => {
|
|
48
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
49
|
+
throw new TypeError(
|
|
50
|
+
`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
consumptions: sdkClient.unmarshalArrayOfObject(
|
|
55
|
+
data.consumptions,
|
|
56
|
+
unmarshalListConsumptionsResponseConsumption
|
|
57
|
+
),
|
|
58
|
+
totalCount: data.total_count,
|
|
59
|
+
totalDiscountUntaxedValue: data.total_discount_untaxed_value,
|
|
60
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const unmarshalDiscountCoupon = (data) => {
|
|
64
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
65
|
+
throw new TypeError(
|
|
66
|
+
`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
description: data.description
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
const unmarshalDiscountFilter = (data) => {
|
|
74
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
75
|
+
throw new TypeError(
|
|
76
|
+
`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
exclude: data.exclude,
|
|
81
|
+
type: data.type,
|
|
82
|
+
value: data.value
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
const unmarshalDiscount = (data) => {
|
|
86
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
87
|
+
throw new TypeError(
|
|
88
|
+
`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : void 0,
|
|
93
|
+
creationDate: sdkClient.unmarshalDate(data.creation_date),
|
|
94
|
+
description: data.description,
|
|
95
|
+
filters: sdkClient.unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
|
|
96
|
+
id: data.id,
|
|
97
|
+
mode: data.mode,
|
|
98
|
+
organizationId: data.organization_id,
|
|
99
|
+
startDate: sdkClient.unmarshalDate(data.start_date),
|
|
100
|
+
stopDate: sdkClient.unmarshalDate(data.stop_date),
|
|
101
|
+
value: data.value,
|
|
102
|
+
valueRemaining: data.value_remaining,
|
|
103
|
+
valueUsed: data.value_used
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
const unmarshalListDiscountsResponse = (data) => {
|
|
107
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
108
|
+
throw new TypeError(
|
|
109
|
+
`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
discounts: sdkClient.unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
|
|
114
|
+
totalCount: data.total_count
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const unmarshalListInvoicesResponse = (data) => {
|
|
118
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
119
|
+
throw new TypeError(
|
|
120
|
+
`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
invoices: sdkClient.unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
|
|
125
|
+
totalCount: data.total_count
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
const unmarshalListTaxesResponseTax = (data) => {
|
|
129
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
130
|
+
throw new TypeError(
|
|
131
|
+
`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
currency: data.currency,
|
|
136
|
+
description: data.description,
|
|
137
|
+
rate: data.rate,
|
|
138
|
+
totalTaxValue: data.total_tax_value
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
const unmarshalListTaxesResponse = (data) => {
|
|
142
|
+
if (!sdkClient.isJSONObject(data)) {
|
|
143
|
+
throw new TypeError(
|
|
144
|
+
`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
taxes: sdkClient.unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
|
|
149
|
+
totalCount: data.total_count,
|
|
150
|
+
updatedAt: sdkClient.unmarshalDate(data.updated_at)
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
exports.unmarshalInvoice = unmarshalInvoice;
|
|
154
|
+
exports.unmarshalListConsumptionsResponse = unmarshalListConsumptionsResponse;
|
|
155
|
+
exports.unmarshalListDiscountsResponse = unmarshalListDiscountsResponse;
|
|
156
|
+
exports.unmarshalListInvoicesResponse = unmarshalListInvoicesResponse;
|
|
157
|
+
exports.unmarshalListTaxesResponse = unmarshalListTaxesResponse;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Invoice, ListConsumptionsResponse, ListDiscountsResponse, ListInvoicesResponse, ListTaxesResponse } from './types.gen';
|
|
2
|
+
export declare const unmarshalInvoice: (data: unknown) => Invoice;
|
|
3
|
+
export declare const unmarshalListConsumptionsResponse: (data: unknown) => ListConsumptionsResponse;
|
|
4
|
+
export declare const unmarshalListDiscountsResponse: (data: unknown) => ListDiscountsResponse;
|
|
5
|
+
export declare const unmarshalListInvoicesResponse: (data: unknown) => ListInvoicesResponse;
|
|
6
|
+
export declare const unmarshalListTaxesResponse: (data: unknown) => ListTaxesResponse;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { isJSONObject, unmarshalMoney, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
|
|
2
|
+
const unmarshalInvoice = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) {
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
`Unmarshalling the type 'Invoice' failed as data isn't a dictionary.`
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
billingPeriod: unmarshalDate(data.billing_period),
|
|
10
|
+
dueDate: unmarshalDate(data.due_date),
|
|
11
|
+
id: data.id,
|
|
12
|
+
issuedDate: unmarshalDate(data.issued_date),
|
|
13
|
+
number: data.number,
|
|
14
|
+
organizationId: data.organization_id,
|
|
15
|
+
organizationName: data.organization_name,
|
|
16
|
+
sellerName: data.seller_name,
|
|
17
|
+
startDate: unmarshalDate(data.start_date),
|
|
18
|
+
state: data.state,
|
|
19
|
+
stopDate: unmarshalDate(data.stop_date),
|
|
20
|
+
totalDiscount: data.total_discount ? unmarshalMoney(data.total_discount) : void 0,
|
|
21
|
+
totalTax: data.total_tax ? unmarshalMoney(data.total_tax) : void 0,
|
|
22
|
+
totalTaxed: data.total_taxed ? unmarshalMoney(data.total_taxed) : void 0,
|
|
23
|
+
totalUndiscount: data.total_undiscount ? unmarshalMoney(data.total_undiscount) : void 0,
|
|
24
|
+
totalUntaxed: data.total_untaxed ? unmarshalMoney(data.total_untaxed) : void 0,
|
|
25
|
+
type: data.type
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const unmarshalListConsumptionsResponseConsumption = (data) => {
|
|
29
|
+
if (!isJSONObject(data)) {
|
|
30
|
+
throw new TypeError(
|
|
31
|
+
`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
billedQuantity: data.billed_quantity,
|
|
36
|
+
categoryName: data.category_name,
|
|
37
|
+
productName: data.product_name,
|
|
38
|
+
projectId: data.project_id,
|
|
39
|
+
resourceName: data.resource_name,
|
|
40
|
+
sku: data.sku,
|
|
41
|
+
unit: data.unit,
|
|
42
|
+
value: data.value ? unmarshalMoney(data.value) : void 0
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const unmarshalListConsumptionsResponse = (data) => {
|
|
46
|
+
if (!isJSONObject(data)) {
|
|
47
|
+
throw new TypeError(
|
|
48
|
+
`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
consumptions: unmarshalArrayOfObject(
|
|
53
|
+
data.consumptions,
|
|
54
|
+
unmarshalListConsumptionsResponseConsumption
|
|
55
|
+
),
|
|
56
|
+
totalCount: data.total_count,
|
|
57
|
+
totalDiscountUntaxedValue: data.total_discount_untaxed_value,
|
|
58
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
const unmarshalDiscountCoupon = (data) => {
|
|
62
|
+
if (!isJSONObject(data)) {
|
|
63
|
+
throw new TypeError(
|
|
64
|
+
`Unmarshalling the type 'DiscountCoupon' failed as data isn't a dictionary.`
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
description: data.description
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const unmarshalDiscountFilter = (data) => {
|
|
72
|
+
if (!isJSONObject(data)) {
|
|
73
|
+
throw new TypeError(
|
|
74
|
+
`Unmarshalling the type 'DiscountFilter' failed as data isn't a dictionary.`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
exclude: data.exclude,
|
|
79
|
+
type: data.type,
|
|
80
|
+
value: data.value
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const unmarshalDiscount = (data) => {
|
|
84
|
+
if (!isJSONObject(data)) {
|
|
85
|
+
throw new TypeError(
|
|
86
|
+
`Unmarshalling the type 'Discount' failed as data isn't a dictionary.`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
coupon: data.coupon ? unmarshalDiscountCoupon(data.coupon) : void 0,
|
|
91
|
+
creationDate: unmarshalDate(data.creation_date),
|
|
92
|
+
description: data.description,
|
|
93
|
+
filters: unmarshalArrayOfObject(data.filters, unmarshalDiscountFilter),
|
|
94
|
+
id: data.id,
|
|
95
|
+
mode: data.mode,
|
|
96
|
+
organizationId: data.organization_id,
|
|
97
|
+
startDate: unmarshalDate(data.start_date),
|
|
98
|
+
stopDate: unmarshalDate(data.stop_date),
|
|
99
|
+
value: data.value,
|
|
100
|
+
valueRemaining: data.value_remaining,
|
|
101
|
+
valueUsed: data.value_used
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const unmarshalListDiscountsResponse = (data) => {
|
|
105
|
+
if (!isJSONObject(data)) {
|
|
106
|
+
throw new TypeError(
|
|
107
|
+
`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
|
|
112
|
+
totalCount: data.total_count
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
const unmarshalListInvoicesResponse = (data) => {
|
|
116
|
+
if (!isJSONObject(data)) {
|
|
117
|
+
throw new TypeError(
|
|
118
|
+
`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
|
|
123
|
+
totalCount: data.total_count
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
const unmarshalListTaxesResponseTax = (data) => {
|
|
127
|
+
if (!isJSONObject(data)) {
|
|
128
|
+
throw new TypeError(
|
|
129
|
+
`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
currency: data.currency,
|
|
134
|
+
description: data.description,
|
|
135
|
+
rate: data.rate,
|
|
136
|
+
totalTaxValue: data.total_tax_value
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
const unmarshalListTaxesResponse = (data) => {
|
|
140
|
+
if (!isJSONObject(data)) {
|
|
141
|
+
throw new TypeError(
|
|
142
|
+
`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
|
|
147
|
+
totalCount: data.total_count,
|
|
148
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
export {
|
|
152
|
+
unmarshalInvoice,
|
|
153
|
+
unmarshalListConsumptionsResponse,
|
|
154
|
+
unmarshalListDiscountsResponse,
|
|
155
|
+
unmarshalListInvoicesResponse,
|
|
156
|
+
unmarshalListTaxesResponse
|
|
157
|
+
};
|