@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.
- package/dist/.vite/license.md +3 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/index.gen.d.ts +6 -0
- package/dist/index.gen.js +3 -0
- package/dist/metadata.gen.d.ts +12 -0
- package/dist/metadata.gen.js +13 -0
- package/dist/v2/api.gen.d.ts +132 -0
- package/dist/v2/api.gen.js +110 -0
- package/dist/v2/index.gen.d.ts +4 -0
- package/dist/v2/index.gen.js +26 -0
- package/dist/v2/marshalling.gen.d.ts +16 -0
- package/dist/v2/marshalling.gen.js +117 -0
- package/dist/v2/metadata.gen.d.ts +53 -0
- package/dist/v2/metadata.gen.js +55 -0
- package/dist/v2/types.gen.d.ts +331 -0
- package/dist/v2/types.gen.js +0 -0
- package/dist/v2/validation-rules.gen.d.ts +33 -0
- package/dist/v2/validation-rules.gen.js +34 -0
- package/dist/v2beta1/api.gen.d.ts +96 -0
- package/dist/v2beta1/api.gen.js +81 -0
- package/dist/v2beta1/index.gen.d.ts +4 -0
- package/dist/v2beta1/index.gen.js +19 -0
- package/dist/v2beta1/marshalling.gen.d.ts +8 -0
- package/dist/v2beta1/marshalling.gen.js +135 -0
- package/dist/v2beta1/metadata.gen.d.ts +78 -0
- package/dist/v2beta1/metadata.gen.js +86 -0
- package/dist/v2beta1/types.gen.d.ts +533 -0
- package/dist/v2beta1/types.gen.js +0 -0
- package/dist/v2beta1/validation-rules.gen.d.ts +6 -0
- package/dist/v2beta1/validation-rules.gen.js +9 -0
- package/package.json +5 -5
- package/LICENSE +0 -191
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import type { Money } from '@scaleway/sdk-client';
|
|
2
|
+
export type BudgetAlertNotificationType = 'unknown_type' | 'sms' | 'email' | 'webhook';
|
|
3
|
+
export type ListElectronicAddressesRequestOrderBy = 'starts_at_asc' | 'starts_at_desc';
|
|
4
|
+
export interface BudgetAlertNotification {
|
|
5
|
+
/**
|
|
6
|
+
* Alert notification's ID.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The creation date of the alert notification.
|
|
11
|
+
*/
|
|
12
|
+
createdAt?: Date;
|
|
13
|
+
/**
|
|
14
|
+
* The last modification date of the alert notification.
|
|
15
|
+
*/
|
|
16
|
+
updatedAt?: Date;
|
|
17
|
+
/**
|
|
18
|
+
* Kind of notification.
|
|
19
|
+
*/
|
|
20
|
+
type: BudgetAlertNotificationType;
|
|
21
|
+
/**
|
|
22
|
+
* List of recipients for this alert.
|
|
23
|
+
*/
|
|
24
|
+
recipients: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface BudgetAlert {
|
|
27
|
+
/**
|
|
28
|
+
* Alert's ID.
|
|
29
|
+
*/
|
|
30
|
+
id: string;
|
|
31
|
+
/**
|
|
32
|
+
* The creation date of the alert.
|
|
33
|
+
*/
|
|
34
|
+
createdAt?: Date;
|
|
35
|
+
/**
|
|
36
|
+
* The last modification date of the alert.
|
|
37
|
+
*/
|
|
38
|
+
updatedAt?: Date;
|
|
39
|
+
/**
|
|
40
|
+
* Percentage threshold of the budget's limit for which the alert is triggered.
|
|
41
|
+
*/
|
|
42
|
+
threshold: number;
|
|
43
|
+
/**
|
|
44
|
+
* Notifications to send when the alert is triggered.
|
|
45
|
+
*/
|
|
46
|
+
notifications: BudgetAlertNotification[];
|
|
47
|
+
}
|
|
48
|
+
export interface Budget {
|
|
49
|
+
/**
|
|
50
|
+
* Budget's ID.
|
|
51
|
+
*/
|
|
52
|
+
id: string;
|
|
53
|
+
/**
|
|
54
|
+
* The creation date of the budget.
|
|
55
|
+
*/
|
|
56
|
+
createdAt?: Date;
|
|
57
|
+
/**
|
|
58
|
+
* The last modification date of the budget.
|
|
59
|
+
*/
|
|
60
|
+
updatedAt?: Date;
|
|
61
|
+
/**
|
|
62
|
+
* The organization ID of the budget.
|
|
63
|
+
*/
|
|
64
|
+
organizationId: string;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the budget is enabled or not.
|
|
67
|
+
*/
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Cost limit for this budget.
|
|
71
|
+
*/
|
|
72
|
+
consumptionLimit?: Money;
|
|
73
|
+
/**
|
|
74
|
+
* Alerts defined for this budget.
|
|
75
|
+
*/
|
|
76
|
+
alerts: BudgetAlert[];
|
|
77
|
+
}
|
|
78
|
+
export interface ElectronicAddress {
|
|
79
|
+
/**
|
|
80
|
+
* The id of the electronic address.
|
|
81
|
+
*/
|
|
82
|
+
id: string;
|
|
83
|
+
/**
|
|
84
|
+
* The start date of the electronic address.
|
|
85
|
+
*/
|
|
86
|
+
startsAt?: Date;
|
|
87
|
+
/**
|
|
88
|
+
* The stop date of the electronic address.
|
|
89
|
+
*/
|
|
90
|
+
stopsAt?: Date;
|
|
91
|
+
/**
|
|
92
|
+
* The creation date of the electronic address.
|
|
93
|
+
*/
|
|
94
|
+
createdAt?: Date;
|
|
95
|
+
/**
|
|
96
|
+
* The last modification date of the electronic address.
|
|
97
|
+
*/
|
|
98
|
+
updatedAt?: Date;
|
|
99
|
+
/**
|
|
100
|
+
* The organization ID of the electronic address.
|
|
101
|
+
*/
|
|
102
|
+
organizationId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Current value of electronic address.
|
|
105
|
+
*/
|
|
106
|
+
value: string;
|
|
107
|
+
}
|
|
108
|
+
export type CreateBudgetAlertNotificationRequest = {
|
|
109
|
+
/**
|
|
110
|
+
* The ID of the budget alert to create notification for.
|
|
111
|
+
*/
|
|
112
|
+
budgetAlertId: string;
|
|
113
|
+
/**
|
|
114
|
+
* List of phone numbers to receive sms notifications.
|
|
115
|
+
*
|
|
116
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
117
|
+
*/
|
|
118
|
+
smsPhoneNumbers?: string[];
|
|
119
|
+
/**
|
|
120
|
+
* List of email addresses to receive email notifications.
|
|
121
|
+
*
|
|
122
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
123
|
+
*/
|
|
124
|
+
emailAddresses?: string[];
|
|
125
|
+
/**
|
|
126
|
+
* List of webhook url to receive webhook notifications.
|
|
127
|
+
*
|
|
128
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
129
|
+
*/
|
|
130
|
+
webhookUrls?: string[];
|
|
131
|
+
};
|
|
132
|
+
export type CreateBudgetAlertRequest = {
|
|
133
|
+
/**
|
|
134
|
+
* The ID of the budget to create alert for.
|
|
135
|
+
*/
|
|
136
|
+
budgetId: string;
|
|
137
|
+
/**
|
|
138
|
+
* Threshold above which the alert is sent.
|
|
139
|
+
*/
|
|
140
|
+
threshold: number;
|
|
141
|
+
};
|
|
142
|
+
export type CreateBudgetRequest = {
|
|
143
|
+
/**
|
|
144
|
+
* The Organization ID of the budget.
|
|
145
|
+
*/
|
|
146
|
+
organizationId?: string;
|
|
147
|
+
/**
|
|
148
|
+
* Cost limit for the budget.
|
|
149
|
+
*/
|
|
150
|
+
consumptionLimit: number;
|
|
151
|
+
/**
|
|
152
|
+
* Whether the budget is enabled or not.
|
|
153
|
+
*/
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
};
|
|
156
|
+
export type DeleteBudgetAlertNotificationRequest = {
|
|
157
|
+
/**
|
|
158
|
+
* The ID of the budget alert notification to delete.
|
|
159
|
+
*/
|
|
160
|
+
budgetAlertNotificationId: string;
|
|
161
|
+
};
|
|
162
|
+
export type DeleteBudgetAlertRequest = {
|
|
163
|
+
/**
|
|
164
|
+
* The ID of the budget alert to delete.
|
|
165
|
+
*/
|
|
166
|
+
budgetAlertId: string;
|
|
167
|
+
};
|
|
168
|
+
export type DeleteBudgetRequest = {
|
|
169
|
+
/**
|
|
170
|
+
* The ID of the budget to delete.
|
|
171
|
+
*/
|
|
172
|
+
budgetId: string;
|
|
173
|
+
};
|
|
174
|
+
export type ElectronicBillingApiCreateElectronicAddressRequest = {
|
|
175
|
+
/**
|
|
176
|
+
* The Organization ID to set electronic address.
|
|
177
|
+
*/
|
|
178
|
+
organizationId?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Electronic address to set.
|
|
181
|
+
*/
|
|
182
|
+
value: string;
|
|
183
|
+
/**
|
|
184
|
+
* When electronic address should be active.
|
|
185
|
+
*/
|
|
186
|
+
startsAt?: Date;
|
|
187
|
+
/**
|
|
188
|
+
* When electronic address should stop being active.
|
|
189
|
+
*/
|
|
190
|
+
stopsAt?: Date;
|
|
191
|
+
};
|
|
192
|
+
export type ElectronicBillingApiDeleteElectronicAddressRequest = {
|
|
193
|
+
/**
|
|
194
|
+
* The ID of the electronic address to delete.
|
|
195
|
+
*/
|
|
196
|
+
electronicAddressId: string;
|
|
197
|
+
};
|
|
198
|
+
export type ElectronicBillingApiGetElectronicAddressRequest = {
|
|
199
|
+
/**
|
|
200
|
+
* The ID of the electronic address we want to retrieve.
|
|
201
|
+
*/
|
|
202
|
+
electronicAddressId: string;
|
|
203
|
+
};
|
|
204
|
+
export type ElectronicBillingApiListElectronicAddressesRequest = {
|
|
205
|
+
/**
|
|
206
|
+
* Page number to return, from the paginated results.
|
|
207
|
+
*/
|
|
208
|
+
page?: number;
|
|
209
|
+
/**
|
|
210
|
+
* Number of Electronic Address to return per page.
|
|
211
|
+
*/
|
|
212
|
+
pageSize?: number;
|
|
213
|
+
/**
|
|
214
|
+
* Sort order of Electronic address in the response.
|
|
215
|
+
*/
|
|
216
|
+
orderBy?: ListElectronicAddressesRequestOrderBy;
|
|
217
|
+
/**
|
|
218
|
+
* The Organization ID to set electronic address.
|
|
219
|
+
*/
|
|
220
|
+
organizationId?: string;
|
|
221
|
+
/**
|
|
222
|
+
* Filter services where electronic address start_date is greater or equal to starts_after.
|
|
223
|
+
*/
|
|
224
|
+
startsAfter?: Date;
|
|
225
|
+
/**
|
|
226
|
+
* Filter services where electronic address stop_date is before stops_before.
|
|
227
|
+
*/
|
|
228
|
+
stopsBefore?: Date;
|
|
229
|
+
};
|
|
230
|
+
export type ElectronicBillingApiUpdateElectronicAddressRequest = {
|
|
231
|
+
/**
|
|
232
|
+
* The ID of the electronic address we want to update.
|
|
233
|
+
*/
|
|
234
|
+
electronicAddressId: string;
|
|
235
|
+
/**
|
|
236
|
+
* Electronic address to set.
|
|
237
|
+
*/
|
|
238
|
+
value?: string;
|
|
239
|
+
/**
|
|
240
|
+
* When electronic address should stop being active.
|
|
241
|
+
*/
|
|
242
|
+
stopsAt?: Date;
|
|
243
|
+
};
|
|
244
|
+
export type GetBudgetRequest = {
|
|
245
|
+
/**
|
|
246
|
+
* The ID of the budget.
|
|
247
|
+
*/
|
|
248
|
+
budgetId: string;
|
|
249
|
+
};
|
|
250
|
+
export type ListBudgetsRequest = {
|
|
251
|
+
/**
|
|
252
|
+
* Filter by organization ID.
|
|
253
|
+
*/
|
|
254
|
+
organizationId?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Page number.
|
|
257
|
+
*/
|
|
258
|
+
page?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Positive integer to select the number of items to return.
|
|
261
|
+
*/
|
|
262
|
+
pageSize?: number;
|
|
263
|
+
};
|
|
264
|
+
export interface ListBudgetsResponse {
|
|
265
|
+
/**
|
|
266
|
+
* Detailed budget list.
|
|
267
|
+
*/
|
|
268
|
+
budgets: Budget[];
|
|
269
|
+
/**
|
|
270
|
+
* Total number of items.
|
|
271
|
+
*/
|
|
272
|
+
totalCount: number;
|
|
273
|
+
}
|
|
274
|
+
export interface ListElectronicAddressesResponse {
|
|
275
|
+
/**
|
|
276
|
+
* List of electronic addresses.
|
|
277
|
+
*/
|
|
278
|
+
electronicAddresses: ElectronicAddress[];
|
|
279
|
+
/**
|
|
280
|
+
* Total Number of returned electronic addresses.
|
|
281
|
+
*/
|
|
282
|
+
totalCount: number;
|
|
283
|
+
}
|
|
284
|
+
export type UpdateBudgetAlertNotificationRequest = {
|
|
285
|
+
/**
|
|
286
|
+
* The ID of the budget alert notification to update.
|
|
287
|
+
*/
|
|
288
|
+
budgetAlertNotificationId: string;
|
|
289
|
+
/**
|
|
290
|
+
* List of phone numbers to receive sms notifications.
|
|
291
|
+
*
|
|
292
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
293
|
+
*/
|
|
294
|
+
smsPhoneNumbers?: string[];
|
|
295
|
+
/**
|
|
296
|
+
* List of email addresses to receive email notifications.
|
|
297
|
+
*
|
|
298
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
299
|
+
*/
|
|
300
|
+
emailAddresses?: string[];
|
|
301
|
+
/**
|
|
302
|
+
* List of webhook url to receive webhook notifications.
|
|
303
|
+
*
|
|
304
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
305
|
+
*/
|
|
306
|
+
webhookUrls?: string[];
|
|
307
|
+
};
|
|
308
|
+
export type UpdateBudgetAlertRequest = {
|
|
309
|
+
/**
|
|
310
|
+
* The ID of the budget alert to update.
|
|
311
|
+
*/
|
|
312
|
+
budgetAlertId: string;
|
|
313
|
+
/**
|
|
314
|
+
* Threshold above which the alert is sent.
|
|
315
|
+
*/
|
|
316
|
+
threshold: number;
|
|
317
|
+
};
|
|
318
|
+
export type UpdateBudgetRequest = {
|
|
319
|
+
/**
|
|
320
|
+
* The ID of the budget to update.
|
|
321
|
+
*/
|
|
322
|
+
budgetId: string;
|
|
323
|
+
/**
|
|
324
|
+
* Cost limit for the budget.
|
|
325
|
+
*/
|
|
326
|
+
consumptionLimit?: number;
|
|
327
|
+
/**
|
|
328
|
+
* Whether the budget will be enabled or not.
|
|
329
|
+
*/
|
|
330
|
+
enabled?: boolean;
|
|
331
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const CreateBudgetAlertRequest: {
|
|
2
|
+
threshold: {
|
|
3
|
+
greaterThanOrEqual: number;
|
|
4
|
+
lessThanOrEqual: number;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const ElectronicBillingApiCreateElectronicAddressRequest: {
|
|
8
|
+
value: {
|
|
9
|
+
maxLength: number;
|
|
10
|
+
minLength: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const ElectronicBillingApiListElectronicAddressesRequest: {
|
|
14
|
+
page: {
|
|
15
|
+
greaterThanOrEqual: number;
|
|
16
|
+
};
|
|
17
|
+
pageSize: {
|
|
18
|
+
greaterThanOrEqual: number;
|
|
19
|
+
lessThanOrEqual: number;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const ElectronicBillingApiUpdateElectronicAddressRequest: {
|
|
23
|
+
value: {
|
|
24
|
+
maxLength: number;
|
|
25
|
+
minLength: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export declare const UpdateBudgetAlertRequest: {
|
|
29
|
+
threshold: {
|
|
30
|
+
greaterThanOrEqual: number;
|
|
31
|
+
lessThanOrEqual: number;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
ElectronicBillingApiCreateElectronicAddressRequest: () => ElectronicBillingApiCreateElectronicAddressRequest,
|
|
6
|
+
ElectronicBillingApiListElectronicAddressesRequest: () => ElectronicBillingApiListElectronicAddressesRequest,
|
|
7
|
+
ElectronicBillingApiUpdateElectronicAddressRequest: () => ElectronicBillingApiUpdateElectronicAddressRequest,
|
|
8
|
+
UpdateBudgetAlertRequest: () => UpdateBudgetAlertRequest
|
|
9
|
+
});
|
|
10
|
+
const CreateBudgetAlertRequest = { threshold: {
|
|
11
|
+
greaterThanOrEqual: 1,
|
|
12
|
+
lessThanOrEqual: 100
|
|
13
|
+
} };
|
|
14
|
+
const ElectronicBillingApiCreateElectronicAddressRequest = { value: {
|
|
15
|
+
maxLength: 115,
|
|
16
|
+
minLength: 1
|
|
17
|
+
} };
|
|
18
|
+
const ElectronicBillingApiListElectronicAddressesRequest = {
|
|
19
|
+
page: { greaterThanOrEqual: 1 },
|
|
20
|
+
pageSize: {
|
|
21
|
+
greaterThanOrEqual: 1,
|
|
22
|
+
lessThanOrEqual: 1e3
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const ElectronicBillingApiUpdateElectronicAddressRequest = { value: {
|
|
26
|
+
maxLength: 115,
|
|
27
|
+
minLength: 1
|
|
28
|
+
} };
|
|
29
|
+
const UpdateBudgetAlertRequest = { threshold: {
|
|
30
|
+
greaterThanOrEqual: 1,
|
|
31
|
+
lessThanOrEqual: 100
|
|
32
|
+
} };
|
|
33
|
+
//#endregion
|
|
34
|
+
export { CreateBudgetAlertRequest, ElectronicBillingApiCreateElectronicAddressRequest, ElectronicBillingApiListElectronicAddressesRequest, ElectronicBillingApiUpdateElectronicAddressRequest, UpdateBudgetAlertRequest, validation_rules_gen_exports };
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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 };
|
|
@@ -0,0 +1,4 @@
|
|
|
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';
|
|
@@ -0,0 +1,19 @@
|
|
|
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 };
|
|
@@ -0,0 +1,8 @@
|
|
|
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;
|