@scaleway/sdk-billing 2.10.0 → 2.12.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.
@@ -0,0 +1,135 @@
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
+ organizationName: data.organization_name,
61
+ price: data.price ? unmarshalMoney(data.price) : void 0,
62
+ projectId: data.project_id,
63
+ projectName: data.project_name,
64
+ resourceId: data.resource_id,
65
+ resourceName: data.resource_name,
66
+ sku: data.sku,
67
+ startDate: unmarshalDate(data.start_date),
68
+ updatedAt: unmarshalDate(data.updated_at)
69
+ };
70
+ };
71
+ const unmarshalListChargesResponse = (data) => {
72
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListChargesResponse' failed as data isn't a dictionary.`);
73
+ return {
74
+ charges: unmarshalArrayOfObject(data.charges, unmarshalCharge),
75
+ nextPageToken: data.next_page_token
76
+ };
77
+ };
78
+ const unmarshalListConsumptionsResponseConsumption = (data) => {
79
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
80
+ return {
81
+ billedQuantity: data.billed_quantity,
82
+ categoryName: data.category_name,
83
+ consumerId: data.consumer_id,
84
+ organizationName: data.organization_name,
85
+ productName: data.product_name,
86
+ projectId: data.project_id,
87
+ projectName: data.project_name,
88
+ resourceName: data.resource_name,
89
+ sku: data.sku,
90
+ unit: data.unit,
91
+ value: data.value ? unmarshalMoney(data.value) : void 0
92
+ };
93
+ };
94
+ const unmarshalListConsumptionsResponse = (data) => {
95
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponse' failed as data isn't a dictionary.`);
96
+ return {
97
+ consumptions: unmarshalArrayOfObject(data.consumptions, unmarshalListConsumptionsResponseConsumption),
98
+ totalCount: data.total_count,
99
+ totalDiscountUntaxedValue: data.total_discount_untaxed_value,
100
+ updatedAt: unmarshalDate(data.updated_at)
101
+ };
102
+ };
103
+ const unmarshalListDiscountsResponse = (data) => {
104
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListDiscountsResponse' failed as data isn't a dictionary.`);
105
+ return {
106
+ discounts: unmarshalArrayOfObject(data.discounts, unmarshalDiscount),
107
+ totalCount: data.total_count
108
+ };
109
+ };
110
+ const unmarshalListInvoicesResponse = (data) => {
111
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListInvoicesResponse' failed as data isn't a dictionary.`);
112
+ return {
113
+ invoices: unmarshalArrayOfObject(data.invoices, unmarshalInvoice),
114
+ totalCount: data.total_count
115
+ };
116
+ };
117
+ const unmarshalListTaxesResponseTax = (data) => {
118
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponseTax' failed as data isn't a dictionary.`);
119
+ return {
120
+ currency: data.currency,
121
+ description: data.description,
122
+ rate: data.rate,
123
+ totalTaxValue: data.total_tax_value
124
+ };
125
+ };
126
+ const unmarshalListTaxesResponse = (data) => {
127
+ if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListTaxesResponse' failed as data isn't a dictionary.`);
128
+ return {
129
+ taxes: unmarshalArrayOfObject(data.taxes, unmarshalListTaxesResponseTax),
130
+ totalCount: data.total_count,
131
+ updatedAt: unmarshalDate(data.updated_at)
132
+ };
133
+ };
134
+ //#endregion
135
+ export { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
@@ -0,0 +1,78 @@
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;
@@ -0,0 +1,86 @@
1
+ //#region src/v2beta1/metadata.gen.ts
2
+ const queriesMetadata = {
3
+ namespace: "billing",
4
+ version: "v2beta1",
5
+ folderName: "billingv2beta1",
6
+ services: [{
7
+ apiClass: "API",
8
+ methods: [
9
+ {
10
+ methodName: "listConsumptions",
11
+ protoName: "ListConsumptions",
12
+ paramsType: "ListConsumptionsRequest",
13
+ returnType: "ListConsumptionsResponse",
14
+ isList: true,
15
+ paginationType: "offset",
16
+ pageParamKey: "page",
17
+ listItemType: "ListConsumptionsResponseConsumption",
18
+ isPrivate: false,
19
+ description: "\""
20
+ },
21
+ {
22
+ methodName: "listTaxes",
23
+ protoName: "ListTaxes",
24
+ paramsType: "ListTaxesRequest",
25
+ returnType: "ListTaxesResponse",
26
+ isList: true,
27
+ paginationType: "offset",
28
+ pageParamKey: "page",
29
+ listItemType: "ListTaxesResponseTax",
30
+ isPrivate: false,
31
+ description: "\""
32
+ },
33
+ {
34
+ methodName: "listInvoices",
35
+ protoName: "ListInvoices",
36
+ paramsType: "ListInvoicesRequest",
37
+ returnType: "ListInvoicesResponse",
38
+ isList: true,
39
+ paginationType: "offset",
40
+ pageParamKey: "page",
41
+ listItemType: "Invoice",
42
+ isPrivate: false,
43
+ description: "\""
44
+ },
45
+ {
46
+ methodName: "getInvoice",
47
+ protoName: "GetInvoice",
48
+ paramsType: "GetInvoiceRequest",
49
+ returnType: "Invoice",
50
+ isList: false,
51
+ paginationType: "none",
52
+ isPrivate: false,
53
+ description: "\""
54
+ },
55
+ {
56
+ methodName: "listDiscounts",
57
+ protoName: "ListDiscounts",
58
+ paramsType: "ListDiscountsRequest",
59
+ returnType: "ListDiscountsResponse",
60
+ isList: true,
61
+ paginationType: "offset",
62
+ pageParamKey: "page",
63
+ listItemType: "Discount",
64
+ isPrivate: false,
65
+ description: "\""
66
+ }
67
+ ]
68
+ }, {
69
+ apiClass: "FinOpsAPI",
70
+ methods: [{
71
+ methodName: "listCharges",
72
+ protoName: "ListCharges",
73
+ paramsType: "FinOpsApiListChargesRequest",
74
+ returnType: "ListChargesResponse",
75
+ isList: true,
76
+ paginationType: "cursor",
77
+ pageParamKey: "pageToken",
78
+ listItemType: "Charge",
79
+ nextPageField: "nextPageToken",
80
+ isPrivate: false,
81
+ description: "\""
82
+ }]
83
+ }]
84
+ };
85
+ //#endregion
86
+ export { queriesMetadata };