@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.
@@ -0,0 +1,400 @@
1
+ import type { Money } from '@scaleway/sdk-client';
2
+ export type DiscountDiscountMode = 'unknown_discount_mode' | 'discount_mode_rate' | 'discount_mode_value' | 'discount_mode_splittable';
3
+ export type DiscountFilterType = 'unknown_type' | 'category_name' | 'product_name' | 'product_range' | 'resource_name' | 'region' | 'zone';
4
+ export type DownloadInvoiceRequestFileType = 'pdf';
5
+ export type ExportInvoicesRequestFileType = 'csv';
6
+ export type ExportInvoicesRequestOrderBy = 'invoice_number_desc' | 'invoice_number_asc' | 'start_date_desc' | 'start_date_asc' | 'issued_date_desc' | 'issued_date_asc' | 'due_date_desc' | 'due_date_asc' | 'total_untaxed_desc' | 'total_untaxed_asc' | 'total_taxed_desc' | 'total_taxed_asc' | 'invoice_type_desc' | 'invoice_type_asc';
7
+ export type InvoiceType = 'unknown_type' | 'periodic' | 'purchase';
8
+ export type ListConsumptionsRequestOrderBy = 'updated_at_desc' | 'updated_at_asc' | 'category_name_desc' | 'category_name_asc';
9
+ export type ListDiscountsRequestOrderBy = 'creation_date_desc' | 'creation_date_asc' | 'start_date_desc' | 'start_date_asc' | 'stop_date_desc' | 'stop_date_asc';
10
+ export type ListInvoicesRequestOrderBy = 'invoice_number_desc' | 'invoice_number_asc' | 'start_date_desc' | 'start_date_asc' | 'issued_date_desc' | 'issued_date_asc' | 'due_date_desc' | 'due_date_asc' | 'total_untaxed_desc' | 'total_untaxed_asc' | 'total_taxed_desc' | 'total_taxed_asc' | 'invoice_type_desc' | 'invoice_type_asc';
11
+ export type ListTaxesRequestOrderBy = 'updated_at_desc' | 'updated_at_asc' | 'category_name_desc' | 'category_name_asc';
12
+ export interface DiscountCoupon {
13
+ /**
14
+ * The description of the coupon.
15
+ */
16
+ description?: string;
17
+ }
18
+ export interface DiscountFilter {
19
+ /**
20
+ * Type of the filter (category name, product name, product range, resource name, region or zone).
21
+ */
22
+ type: DiscountFilterType;
23
+ /**
24
+ * Value of filter.
25
+ */
26
+ value: string;
27
+ /**
28
+ * Boolean to describe if filter is an excluding filter.
29
+ */
30
+ exclude: boolean;
31
+ }
32
+ export interface ListConsumptionsResponseConsumption {
33
+ /**
34
+ * Monetary value of the consumption.
35
+ */
36
+ value?: Money;
37
+ /**
38
+ * The product name. For example, "VPC Public Gateway S", "VPC Public Gateway M" for the VPC product.
39
+ */
40
+ productName: string;
41
+ /**
42
+ * Identifies the reference based on the category.
43
+ */
44
+ resourceName: string;
45
+ /**
46
+ * Unique identifier of the product.
47
+ */
48
+ sku: string;
49
+ /**
50
+ * Project ID of the consumption.
51
+ */
52
+ projectId: string;
53
+ /**
54
+ * Name of consumption category.
55
+ */
56
+ categoryName: string;
57
+ /**
58
+ * Unit of consumed quantity.
59
+ */
60
+ unit: string;
61
+ /**
62
+ * Consumed quantity.
63
+ */
64
+ billedQuantity: string;
65
+ }
66
+ export interface Discount {
67
+ /**
68
+ * The ID of the discount.
69
+ */
70
+ id: string;
71
+ /**
72
+ * The creation date of the discount.
73
+ */
74
+ creationDate?: Date;
75
+ /**
76
+ * The Organization ID of the discount.
77
+ */
78
+ organizationId: string;
79
+ /**
80
+ * The description of the discount.
81
+ */
82
+ description: string;
83
+ /**
84
+ * The initial value of the discount.
85
+ */
86
+ value: number;
87
+ /**
88
+ * The value indicating how much of the discount has been used.
89
+ */
90
+ valueUsed: number;
91
+ /**
92
+ * The remaining value of the discount.
93
+ */
94
+ valueRemaining: number;
95
+ /**
96
+ * The mode of the discount.
97
+ */
98
+ mode: DiscountDiscountMode;
99
+ /**
100
+ * The start date of the discount.
101
+ */
102
+ startDate?: Date;
103
+ /**
104
+ * The stop date of the discount.
105
+ */
106
+ stopDate?: Date;
107
+ /**
108
+ * The description of the coupon.
109
+ */
110
+ coupon?: DiscountCoupon;
111
+ /**
112
+ * List of the discount scopes.
113
+ */
114
+ filters: DiscountFilter[];
115
+ }
116
+ export interface Invoice {
117
+ /**
118
+ * Invoice ID.
119
+ */
120
+ id: string;
121
+ organizationId: string;
122
+ organizationName: string;
123
+ /**
124
+ * Start date of the billing period.
125
+ */
126
+ startDate?: Date;
127
+ stopDate?: Date;
128
+ /**
129
+ * The billing period of the invoice in the YYYY-MM format.
130
+ */
131
+ billingPeriod?: Date;
132
+ /**
133
+ * Date when the invoice was sent to the customer.
134
+ */
135
+ issuedDate?: Date;
136
+ /**
137
+ * Payment time limit, set according to the Organization's payment conditions.
138
+ */
139
+ dueDate?: Date;
140
+ /**
141
+ * Total amount, untaxed.
142
+ */
143
+ totalUntaxed?: Money;
144
+ /**
145
+ * Total amount, taxed.
146
+ */
147
+ totalTaxed?: Money;
148
+ /**
149
+ * The total tax amount of the invoice.
150
+ */
151
+ totalTax?: Money;
152
+ /**
153
+ * The total discount amount of the invoice.
154
+ */
155
+ totalDiscount?: Money;
156
+ /**
157
+ * The total amount of the invoice before applying the discount.
158
+ */
159
+ totalUndiscount?: Money;
160
+ /**
161
+ * Type of invoice, either periodic or purchase.
162
+ */
163
+ type: InvoiceType;
164
+ /**
165
+ * The state of the Invoice.
166
+ */
167
+ state: string;
168
+ /**
169
+ * Invoice number.
170
+ */
171
+ number: number;
172
+ /**
173
+ * The name of the seller (Scaleway).
174
+ */
175
+ sellerName: string;
176
+ }
177
+ export interface ListTaxesResponseTax {
178
+ /**
179
+ * Description of the tax applied.
180
+ */
181
+ description: string;
182
+ /**
183
+ * The three-letter currency code.
184
+ */
185
+ currency: string;
186
+ /**
187
+ * Applied tax rate (0.2 means a VAT of 20%).
188
+ */
189
+ rate?: number;
190
+ /**
191
+ * The total tax value of the consumption.
192
+ */
193
+ totalTaxValue?: number;
194
+ }
195
+ export type DownloadInvoiceRequest = {
196
+ /**
197
+ * Invoice ID.
198
+ */
199
+ invoiceId: string;
200
+ /**
201
+ * File type. PDF by default.
202
+ */
203
+ fileType?: DownloadInvoiceRequestFileType;
204
+ };
205
+ export type ExportInvoicesRequest = {
206
+ /**
207
+ * Organization ID. If specified, only invoices from this Organization will be returned.
208
+ */
209
+ organizationId?: string;
210
+ /**
211
+ * Return only invoice with start date greater than billing_period_start.
212
+ */
213
+ billingPeriodStartAfter?: Date;
214
+ /**
215
+ * Return only invoice with start date less than billing_period_start.
216
+ */
217
+ billingPeriodStartBefore?: Date;
218
+ /**
219
+ * Invoice type. It can either be `periodic` or `purchase`.
220
+ */
221
+ invoiceType?: InvoiceType;
222
+ /**
223
+ * Page number.
224
+ */
225
+ page?: number;
226
+ /**
227
+ * Positive integer lower or equal to 100 to select the number of items to return.
228
+ */
229
+ pageSize?: number;
230
+ /**
231
+ * How invoices are ordered in the response.
232
+ */
233
+ orderBy?: ExportInvoicesRequestOrderBy;
234
+ /**
235
+ * File format for exporting the invoice list.
236
+ */
237
+ fileType?: ExportInvoicesRequestFileType;
238
+ };
239
+ export type GetInvoiceRequest = {
240
+ /**
241
+ * Invoice ID.
242
+ */
243
+ invoiceId: string;
244
+ };
245
+ export type ListConsumptionsRequest = {
246
+ /**
247
+ * Order consumptions list in the response by their update date.
248
+ */
249
+ orderBy?: ListConsumptionsRequestOrderBy;
250
+ /**
251
+ * Positive integer to choose the page to return.
252
+ */
253
+ page?: number;
254
+ /**
255
+ * Positive integer lower or equal to 100 to select the number of items to return.
256
+ */
257
+ pageSize?: number;
258
+ /**
259
+ * Filter by Organization ID.
260
+ *
261
+ * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' could be set.
262
+ */
263
+ organizationId?: string;
264
+ /**
265
+ * Filter by Project ID.
266
+ *
267
+ * One-of ('projectIdentifier'): at most one of 'organizationId', 'projectId' could be set.
268
+ */
269
+ projectId?: string;
270
+ /**
271
+ * Filter by name of a Category as they are shown in the invoice (Compute, Network, Observability).
272
+ */
273
+ categoryName?: string;
274
+ /**
275
+ * Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default.
276
+ */
277
+ billingPeriod?: string;
278
+ };
279
+ export interface ListConsumptionsResponse {
280
+ /**
281
+ * Detailed consumption list.
282
+ */
283
+ consumptions: ListConsumptionsResponseConsumption[];
284
+ /**
285
+ * Total number of returned items.
286
+ */
287
+ totalCount: number;
288
+ /**
289
+ * Sum of all discounts, displayed only when no category or project ID filter is applied.
290
+ */
291
+ totalDiscountUntaxedValue: number;
292
+ /**
293
+ * Last consumption update date.
294
+ */
295
+ updatedAt?: Date;
296
+ }
297
+ export type ListDiscountsRequest = {
298
+ /**
299
+ * Order discounts in the response by their description.
300
+ */
301
+ orderBy?: ListDiscountsRequestOrderBy;
302
+ /**
303
+ * Positive integer to choose the page to return.
304
+ */
305
+ page?: number;
306
+ /**
307
+ * Positive integer lower or equal to 100 to select the number of items to return.
308
+ */
309
+ pageSize?: number;
310
+ /**
311
+ * ID of the organization.
312
+ */
313
+ organizationId?: string;
314
+ };
315
+ export interface ListDiscountsResponse {
316
+ /**
317
+ * Total number of discounts.
318
+ */
319
+ totalCount: number;
320
+ /**
321
+ * Paginated returned discounts.
322
+ */
323
+ discounts: Discount[];
324
+ }
325
+ export type ListInvoicesRequest = {
326
+ /**
327
+ * Organization ID. If specified, only invoices from this Organization will be returned.
328
+ */
329
+ organizationId?: string;
330
+ /**
331
+ * Return only invoice with start date greater than billing_period_start.
332
+ */
333
+ billingPeriodStartAfter?: Date;
334
+ /**
335
+ * Return only invoice with start date less than billing_period_start.
336
+ */
337
+ billingPeriodStartBefore?: Date;
338
+ /**
339
+ * Invoice type. It can either be `periodic` or `purchase`.
340
+ */
341
+ invoiceType?: InvoiceType;
342
+ /**
343
+ * Page number.
344
+ */
345
+ page?: number;
346
+ /**
347
+ * Positive integer lower or equal to 100 to select the number of items to return.
348
+ */
349
+ pageSize?: number;
350
+ /**
351
+ * How invoices are ordered in the response.
352
+ */
353
+ orderBy?: ListInvoicesRequestOrderBy;
354
+ };
355
+ export interface ListInvoicesResponse {
356
+ /**
357
+ * Total number of invoices.
358
+ */
359
+ totalCount: number;
360
+ /**
361
+ * Paginated returned invoices.
362
+ */
363
+ invoices: Invoice[];
364
+ }
365
+ export type ListTaxesRequest = {
366
+ /**
367
+ * Order consumed taxes list in the response by their update date.
368
+ */
369
+ orderBy?: ListTaxesRequestOrderBy;
370
+ /**
371
+ * Page number.
372
+ */
373
+ page?: number;
374
+ /**
375
+ * Positive integer lower or equal to 100 to select the number of items to return.
376
+ */
377
+ pageSize?: number;
378
+ /**
379
+ * Filter by Organization ID.
380
+ */
381
+ organizationId?: string;
382
+ /**
383
+ * Filter by the billing period in the YYYY-MM format. If it is empty the current billing period will be used as default.
384
+ */
385
+ billingPeriod?: string;
386
+ };
387
+ export interface ListTaxesResponse {
388
+ /**
389
+ * Detailed consumption tax.
390
+ */
391
+ taxes: ListTaxesResponseTax[];
392
+ /**
393
+ * Total number of returned items.
394
+ */
395
+ totalCount: number;
396
+ /**
397
+ * Last consumption update date.
398
+ */
399
+ updatedAt?: Date;
400
+ }
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@scaleway/sdk-billing",
3
+ "version": "1.0.1",
4
+ "description": "Scaleway SDK billing",
5
+ "types": "dist/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "type": "module",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.gen.d.ts",
13
+ "import": "./dist/index.gen.js",
14
+ "require": "./dist/index.gen.cjs",
15
+ "default": "./dist/index.gen.js"
16
+ },
17
+ "./*": {
18
+ "types": "./dist/*/index.gen.d.ts",
19
+ "import": "./dist/*/index.gen.js",
20
+ "require": "./dist/*/index.gen.cjs",
21
+ "default": "./dist/*/index.gen.js"
22
+ }
23
+ },
24
+ "repository": {
25
+ "type": "git",
26
+ "directory": "packages_generated/billing"
27
+ },
28
+ "engines": {
29
+ "node": ">=20.18.3"
30
+ },
31
+ "dependencies": {
32
+ "@scaleway/random-name": "5.1.1",
33
+ "@scaleway/sdk-std": "1.0.1"
34
+ },
35
+ "peerDependencies": {
36
+ "@scaleway/sdk-client": "^1.2.1"
37
+ },
38
+ "devDependencies": {
39
+ "@scaleway/sdk-client": "^1.2.1"
40
+ },
41
+ "bundledDependencies": [
42
+ "@scaleway/random-name"
43
+ ],
44
+ "scripts": {
45
+ "package:check": "pnpm publint",
46
+ "typecheck": "tsc --noEmit",
47
+ "type:generate": "tsc --declaration -p tsconfig.build.json",
48
+ "build": "vite build --config vite.config.ts && pnpm run type:generate",
49
+ "build:profile": "npx vite-bundle-visualizer -c vite.config.ts"
50
+ }
51
+ }