@scaleway/sdk-billing 2.5.1 → 2.7.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/index.gen.d.ts +1 -0
- package/dist/index.gen.js +3 -2
- package/dist/metadata.gen.d.ts +1 -1
- package/dist/metadata.gen.js +1 -1
- package/dist/v2/api.gen.d.ts +87 -0
- package/dist/v2/api.gen.js +74 -0
- package/dist/v2/index.gen.d.ts +4 -0
- package/dist/v2/index.gen.js +21 -0
- package/dist/v2/marshalling.gen.d.ts +12 -0
- package/dist/v2/marshalling.gen.js +88 -0
- package/dist/v2/metadata.gen.d.ts +30 -0
- package/dist/v2/metadata.gen.js +32 -0
- package/dist/v2/types.gen.d.ts +220 -0
- package/dist/v2/types.gen.js +0 -0
- package/dist/v2/validation-rules.gen.d.ts +12 -0
- package/dist/v2/validation-rules.gen.js +16 -0
- package/dist/v2beta1/api.gen.d.ts +13 -1
- package/dist/v2beta1/api.gen.js +15 -2
- package/dist/v2beta1/index.gen.d.ts +3 -2
- package/dist/v2beta1/index.gen.js +7 -3
- package/dist/v2beta1/marshalling.gen.d.ts +2 -1
- package/dist/v2beta1/marshalling.gen.js +23 -1
- package/dist/v2beta1/metadata.gen.d.ts +57 -42
- package/dist/v2beta1/metadata.gen.js +15 -0
- package/dist/v2beta1/types.gen.d.ts +103 -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/dist/index.gen.d.ts
CHANGED
package/dist/index.gen.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { index_gen_exports } from "./
|
|
2
|
-
|
|
1
|
+
import { index_gen_exports } from "./v2/index.gen.js";
|
|
2
|
+
import { index_gen_exports as index_gen_exports$1 } from "./v2beta1/index.gen.js";
|
|
3
|
+
export { index_gen_exports as Billingv2, index_gen_exports$1 as Billingv2beta1 };
|
package/dist/metadata.gen.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare const pkgMetadata: {
|
|
|
6
6
|
readonly name: "@scaleway/sdk-billing";
|
|
7
7
|
readonly namespace: "billing";
|
|
8
8
|
readonly displayName: "Billing";
|
|
9
|
-
readonly versions: readonly ["v2beta1"];
|
|
9
|
+
readonly versions: readonly ["v2", "v2beta1"];
|
|
10
10
|
};
|
|
11
11
|
export type Metadata = typeof pkgMetadata;
|
|
12
12
|
export default pkgMetadata;
|
package/dist/metadata.gen.js
CHANGED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
+
import type { Budget, BudgetAlert, BudgetAlertNotification, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, DeleteBudgetAlertNotificationRequest, DeleteBudgetAlertRequest, DeleteBudgetRequest, GetBudgetRequest, ListBudgetsRequest, ListBudgetsResponse, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest } from './types.gen.js';
|
|
3
|
+
/**
|
|
4
|
+
* Billing API.
|
|
5
|
+
|
|
6
|
+
This API allows you to query billing related objects.
|
|
7
|
+
*/
|
|
8
|
+
export declare class API extends ParentAPI {
|
|
9
|
+
protected pageOfListBudgets: (request?: Readonly<ListBudgetsRequest>) => Promise<ListBudgetsResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* List your budgets, filtering by `organization_id`.. List your budgets, filtering by `organization_id`.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The request {@link ListBudgetsRequest}
|
|
14
|
+
* @returns A Promise of ListBudgetsResponse
|
|
15
|
+
*/
|
|
16
|
+
listBudgets: (request?: Readonly<ListBudgetsRequest>) => Promise<ListBudgetsResponse> & {
|
|
17
|
+
all: () => Promise<Budget[]>;
|
|
18
|
+
[Symbol.asyncIterator]: () => AsyncGenerator<Budget[], void, void>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Fetch a budget.. Fetch a budget.
|
|
22
|
+
*
|
|
23
|
+
* @param request - The request {@link GetBudgetRequest}
|
|
24
|
+
* @returns A Promise of Budget
|
|
25
|
+
*/
|
|
26
|
+
getBudget: (request: Readonly<GetBudgetRequest>) => Promise<Budget>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new budget.. Create a new budget.
|
|
29
|
+
*
|
|
30
|
+
* @param request - The request {@link CreateBudgetRequest}
|
|
31
|
+
* @returns A Promise of Budget
|
|
32
|
+
*/
|
|
33
|
+
createBudget: (request: Readonly<CreateBudgetRequest>) => Promise<Budget>;
|
|
34
|
+
/**
|
|
35
|
+
* Update a budget.. Update a budget.
|
|
36
|
+
*
|
|
37
|
+
* @param request - The request {@link UpdateBudgetRequest}
|
|
38
|
+
* @returns A Promise of Budget
|
|
39
|
+
*/
|
|
40
|
+
updateBudget: (request: Readonly<UpdateBudgetRequest>) => Promise<Budget>;
|
|
41
|
+
/**
|
|
42
|
+
* Delete a budget.. Delete a budget.
|
|
43
|
+
*
|
|
44
|
+
* @param request - The request {@link DeleteBudgetRequest}
|
|
45
|
+
*/
|
|
46
|
+
deleteBudget: (request: Readonly<DeleteBudgetRequest>) => Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Create a new budget alert.. Create a new budget alert.
|
|
49
|
+
*
|
|
50
|
+
* @param request - The request {@link CreateBudgetAlertRequest}
|
|
51
|
+
* @returns A Promise of BudgetAlert
|
|
52
|
+
*/
|
|
53
|
+
createBudgetAlert: (request: Readonly<CreateBudgetAlertRequest>) => Promise<BudgetAlert>;
|
|
54
|
+
/**
|
|
55
|
+
* Update a budget alert.. Update a budget alert.
|
|
56
|
+
*
|
|
57
|
+
* @param request - The request {@link UpdateBudgetAlertRequest}
|
|
58
|
+
* @returns A Promise of BudgetAlert
|
|
59
|
+
*/
|
|
60
|
+
updateBudgetAlert: (request: Readonly<UpdateBudgetAlertRequest>) => Promise<BudgetAlert>;
|
|
61
|
+
/**
|
|
62
|
+
* Delete a budget alert.. Delete a budget alert.
|
|
63
|
+
*
|
|
64
|
+
* @param request - The request {@link DeleteBudgetAlertRequest}
|
|
65
|
+
*/
|
|
66
|
+
deleteBudgetAlert: (request: Readonly<DeleteBudgetAlertRequest>) => Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Create a new budget alert notification.. Create a new budget alert notification.
|
|
69
|
+
*
|
|
70
|
+
* @param request - The request {@link CreateBudgetAlertNotificationRequest}
|
|
71
|
+
* @returns A Promise of BudgetAlertNotification
|
|
72
|
+
*/
|
|
73
|
+
createBudgetAlertNotification: (request: Readonly<CreateBudgetAlertNotificationRequest>) => Promise<BudgetAlertNotification>;
|
|
74
|
+
/**
|
|
75
|
+
* Update a budget alert notification.. Update a budget alert notification.
|
|
76
|
+
*
|
|
77
|
+
* @param request - The request {@link UpdateBudgetAlertNotificationRequest}
|
|
78
|
+
* @returns A Promise of BudgetAlertNotification
|
|
79
|
+
*/
|
|
80
|
+
updateBudgetAlertNotification: (request: Readonly<UpdateBudgetAlertNotificationRequest>) => Promise<BudgetAlertNotification>;
|
|
81
|
+
/**
|
|
82
|
+
* Delete a budget alert notification.. Delete a budget alert notification.
|
|
83
|
+
*
|
|
84
|
+
* @param request - The request {@link DeleteBudgetAlertNotificationRequest}
|
|
85
|
+
*/
|
|
86
|
+
deleteBudgetAlertNotification: (request: Readonly<DeleteBudgetAlertNotificationRequest>) => Promise<void>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse } from "./marshalling.gen.js";
|
|
2
|
+
import { API as API$1, enrichForPagination, urlParams, validatePathParam } from "@scaleway/sdk-client";
|
|
3
|
+
//#region src/v2/api.gen.ts
|
|
4
|
+
const jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
|
|
5
|
+
/**
|
|
6
|
+
* Billing API.
|
|
7
|
+
|
|
8
|
+
This API allows you to query billing related objects.
|
|
9
|
+
*/
|
|
10
|
+
var API = class extends API$1 {
|
|
11
|
+
constructor(..._args) {
|
|
12
|
+
super(..._args);
|
|
13
|
+
this.pageOfListBudgets = (request = {}) => this.client.fetch({
|
|
14
|
+
method: "GET",
|
|
15
|
+
path: `/billing/v2/budgets`,
|
|
16
|
+
urlParams: urlParams(["organization_id", request.organizationId], ["page", request.page], ["page_size", request.pageSize ?? this.client.settings.defaultPageSize])
|
|
17
|
+
}, unmarshalListBudgetsResponse);
|
|
18
|
+
this.listBudgets = (request = {}) => enrichForPagination("budgets", this.pageOfListBudgets, request);
|
|
19
|
+
this.getBudget = (request) => this.client.fetch({
|
|
20
|
+
method: "GET",
|
|
21
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
22
|
+
}, unmarshalBudget);
|
|
23
|
+
this.createBudget = (request) => this.client.fetch({
|
|
24
|
+
body: JSON.stringify(marshalCreateBudgetRequest(request, this.client.settings)),
|
|
25
|
+
headers: jsonContentHeaders,
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: `/billing/v2/budgets`
|
|
28
|
+
}, unmarshalBudget);
|
|
29
|
+
this.updateBudget = (request) => this.client.fetch({
|
|
30
|
+
body: JSON.stringify(marshalUpdateBudgetRequest(request, this.client.settings)),
|
|
31
|
+
headers: jsonContentHeaders,
|
|
32
|
+
method: "PATCH",
|
|
33
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
34
|
+
}, unmarshalBudget);
|
|
35
|
+
this.deleteBudget = (request) => this.client.fetch({
|
|
36
|
+
method: "DELETE",
|
|
37
|
+
path: `/billing/v2/budgets/${validatePathParam("budgetId", request.budgetId)}`
|
|
38
|
+
});
|
|
39
|
+
this.createBudgetAlert = (request) => this.client.fetch({
|
|
40
|
+
body: JSON.stringify(marshalCreateBudgetAlertRequest(request, this.client.settings)),
|
|
41
|
+
headers: jsonContentHeaders,
|
|
42
|
+
method: "POST",
|
|
43
|
+
path: `/billing/v2/budget-alerts`
|
|
44
|
+
}, unmarshalBudgetAlert);
|
|
45
|
+
this.updateBudgetAlert = (request) => this.client.fetch({
|
|
46
|
+
body: JSON.stringify(marshalUpdateBudgetAlertRequest(request, this.client.settings)),
|
|
47
|
+
headers: jsonContentHeaders,
|
|
48
|
+
method: "PATCH",
|
|
49
|
+
path: `/billing/v2/budget-alerts/${validatePathParam("budgetAlertId", request.budgetAlertId)}`
|
|
50
|
+
}, unmarshalBudgetAlert);
|
|
51
|
+
this.deleteBudgetAlert = (request) => this.client.fetch({
|
|
52
|
+
method: "DELETE",
|
|
53
|
+
path: `/billing/v2/budget-alerts/${validatePathParam("budgetAlertId", request.budgetAlertId)}`
|
|
54
|
+
});
|
|
55
|
+
this.createBudgetAlertNotification = (request) => this.client.fetch({
|
|
56
|
+
body: JSON.stringify(marshalCreateBudgetAlertNotificationRequest(request, this.client.settings)),
|
|
57
|
+
headers: jsonContentHeaders,
|
|
58
|
+
method: "POST",
|
|
59
|
+
path: `/billing/v2/budget-alert-notifications`
|
|
60
|
+
}, unmarshalBudgetAlertNotification);
|
|
61
|
+
this.updateBudgetAlertNotification = (request) => this.client.fetch({
|
|
62
|
+
body: JSON.stringify(marshalUpdateBudgetAlertNotificationRequest(request, this.client.settings)),
|
|
63
|
+
headers: jsonContentHeaders,
|
|
64
|
+
method: "PATCH",
|
|
65
|
+
path: `/billing/v2/budget-alert-notifications/${validatePathParam("budgetAlertNotificationId", request.budgetAlertNotificationId)}`
|
|
66
|
+
}, unmarshalBudgetAlertNotification);
|
|
67
|
+
this.deleteBudgetAlertNotification = (request) => this.client.fetch({
|
|
68
|
+
method: "DELETE",
|
|
69
|
+
path: `/billing/v2/budget-alert-notifications/${validatePathParam("budgetAlertNotificationId", request.budgetAlertNotificationId)}`
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { API };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { API, } from './api.gen.js';
|
|
2
|
+
export * from './marshalling.gen.js';
|
|
3
|
+
export type { Budget, BudgetAlert, BudgetAlertNotification, BudgetAlertNotificationType, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, DeleteBudgetAlertNotificationRequest, DeleteBudgetAlertRequest, DeleteBudgetRequest, GetBudgetRequest, ListBudgetsRequest, ListBudgetsResponse, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest, } from './types.gen.js';
|
|
4
|
+
export * as ValidationRules from './validation-rules.gen.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse } from "./marshalling.gen.js";
|
|
3
|
+
import { API } from "./api.gen.js";
|
|
4
|
+
import { validation_rules_gen_exports } from "./validation-rules.gen.js";
|
|
5
|
+
//#region src/v2/index.gen.ts
|
|
6
|
+
var index_gen_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
API: () => API,
|
|
8
|
+
ValidationRules: () => validation_rules_gen_exports,
|
|
9
|
+
marshalCreateBudgetAlertNotificationRequest: () => marshalCreateBudgetAlertNotificationRequest,
|
|
10
|
+
marshalCreateBudgetAlertRequest: () => marshalCreateBudgetAlertRequest,
|
|
11
|
+
marshalCreateBudgetRequest: () => marshalCreateBudgetRequest,
|
|
12
|
+
marshalUpdateBudgetAlertNotificationRequest: () => marshalUpdateBudgetAlertNotificationRequest,
|
|
13
|
+
marshalUpdateBudgetAlertRequest: () => marshalUpdateBudgetAlertRequest,
|
|
14
|
+
marshalUpdateBudgetRequest: () => marshalUpdateBudgetRequest,
|
|
15
|
+
unmarshalBudget: () => unmarshalBudget,
|
|
16
|
+
unmarshalBudgetAlert: () => unmarshalBudgetAlert,
|
|
17
|
+
unmarshalBudgetAlertNotification: () => unmarshalBudgetAlertNotification,
|
|
18
|
+
unmarshalListBudgetsResponse: () => unmarshalListBudgetsResponse
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { API, validation_rules_gen_exports as ValidationRules, index_gen_exports, marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DefaultValues } from '@scaleway/sdk-client';
|
|
2
|
+
import type { BudgetAlertNotification, BudgetAlert, Budget, ListBudgetsResponse, CreateBudgetAlertNotificationRequest, CreateBudgetAlertRequest, CreateBudgetRequest, UpdateBudgetAlertNotificationRequest, UpdateBudgetAlertRequest, UpdateBudgetRequest } from './types.gen.js';
|
|
3
|
+
export declare const unmarshalBudgetAlertNotification: (data: unknown) => BudgetAlertNotification;
|
|
4
|
+
export declare const unmarshalBudgetAlert: (data: unknown) => BudgetAlert;
|
|
5
|
+
export declare const unmarshalBudget: (data: unknown) => Budget;
|
|
6
|
+
export declare const unmarshalListBudgetsResponse: (data: unknown) => ListBudgetsResponse;
|
|
7
|
+
export declare const marshalCreateBudgetAlertNotificationRequest: (request: CreateBudgetAlertNotificationRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
8
|
+
export declare const marshalCreateBudgetAlertRequest: (request: CreateBudgetAlertRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
9
|
+
export declare const marshalCreateBudgetRequest: (request: CreateBudgetRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
10
|
+
export declare const marshalUpdateBudgetAlertNotificationRequest: (request: UpdateBudgetAlertNotificationRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
11
|
+
export declare const marshalUpdateBudgetAlertRequest: (request: UpdateBudgetAlertRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
12
|
+
export declare const marshalUpdateBudgetRequest: (request: UpdateBudgetRequest, defaults: DefaultValues) => Record<string, unknown>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isJSONObject, resolveOneOf, unmarshalArrayOfObject, unmarshalDate, unmarshalMoney } from "@scaleway/sdk-client";
|
|
2
|
+
//#region src/v2/marshalling.gen.ts
|
|
3
|
+
const unmarshalBudgetAlertNotification = (data) => {
|
|
4
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BudgetAlertNotification' failed as data isn't a dictionary.`);
|
|
5
|
+
return {
|
|
6
|
+
createdAt: unmarshalDate(data.created_at),
|
|
7
|
+
id: data.id,
|
|
8
|
+
recipients: data.recipients,
|
|
9
|
+
type: data.type,
|
|
10
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
const unmarshalBudgetAlert = (data) => {
|
|
14
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'BudgetAlert' failed as data isn't a dictionary.`);
|
|
15
|
+
return {
|
|
16
|
+
createdAt: unmarshalDate(data.created_at),
|
|
17
|
+
id: data.id,
|
|
18
|
+
notifications: unmarshalArrayOfObject(data.notifications, unmarshalBudgetAlertNotification),
|
|
19
|
+
threshold: data.threshold,
|
|
20
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const unmarshalBudget = (data) => {
|
|
24
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Budget' failed as data isn't a dictionary.`);
|
|
25
|
+
return {
|
|
26
|
+
alerts: unmarshalArrayOfObject(data.alerts, unmarshalBudgetAlert),
|
|
27
|
+
consumptionLimit: data.consumption_limit ? unmarshalMoney(data.consumption_limit) : void 0,
|
|
28
|
+
createdAt: unmarshalDate(data.created_at),
|
|
29
|
+
enabled: data.enabled,
|
|
30
|
+
id: data.id,
|
|
31
|
+
organizationId: data.organization_id,
|
|
32
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const unmarshalListBudgetsResponse = (data) => {
|
|
36
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListBudgetsResponse' failed as data isn't a dictionary.`);
|
|
37
|
+
return {
|
|
38
|
+
budgets: unmarshalArrayOfObject(data.budgets, unmarshalBudget),
|
|
39
|
+
totalCount: data.total_count
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const marshalCreateBudgetAlertNotificationRequest = (request, defaults) => ({
|
|
43
|
+
budget_alert_id: request.budgetAlertId,
|
|
44
|
+
...resolveOneOf([
|
|
45
|
+
{
|
|
46
|
+
param: "sms_phone_numbers",
|
|
47
|
+
value: request.smsPhoneNumbers
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
param: "email_addresses",
|
|
51
|
+
value: request.emailAddresses
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
param: "webhook_urls",
|
|
55
|
+
value: request.webhookUrls
|
|
56
|
+
}
|
|
57
|
+
])
|
|
58
|
+
});
|
|
59
|
+
const marshalCreateBudgetAlertRequest = (request, defaults) => ({
|
|
60
|
+
budget_id: request.budgetId,
|
|
61
|
+
threshold: request.threshold
|
|
62
|
+
});
|
|
63
|
+
const marshalCreateBudgetRequest = (request, defaults) => ({
|
|
64
|
+
consumption_limit: request.consumptionLimit,
|
|
65
|
+
enabled: request.enabled,
|
|
66
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId
|
|
67
|
+
});
|
|
68
|
+
const marshalUpdateBudgetAlertNotificationRequest = (request, defaults) => ({ ...resolveOneOf([
|
|
69
|
+
{
|
|
70
|
+
param: "sms_phone_numbers",
|
|
71
|
+
value: request.smsPhoneNumbers
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
param: "email_addresses",
|
|
75
|
+
value: request.emailAddresses
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
param: "webhook_urls",
|
|
79
|
+
value: request.webhookUrls
|
|
80
|
+
}
|
|
81
|
+
]) });
|
|
82
|
+
const marshalUpdateBudgetAlertRequest = (request, defaults) => ({ threshold: request.threshold });
|
|
83
|
+
const marshalUpdateBudgetRequest = (request, defaults) => ({
|
|
84
|
+
consumption_limit: request.consumptionLimit,
|
|
85
|
+
enabled: request.enabled
|
|
86
|
+
});
|
|
87
|
+
//#endregion
|
|
88
|
+
export { marshalCreateBudgetAlertNotificationRequest, marshalCreateBudgetAlertRequest, marshalCreateBudgetRequest, marshalUpdateBudgetAlertNotificationRequest, marshalUpdateBudgetAlertRequest, marshalUpdateBudgetRequest, unmarshalBudget, unmarshalBudgetAlert, unmarshalBudgetAlertNotification, unmarshalListBudgetsResponse };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const queriesMetadata: {
|
|
2
|
+
readonly namespace: 'billing';
|
|
3
|
+
readonly version: 'v2';
|
|
4
|
+
readonly folderName: 'billingv2';
|
|
5
|
+
readonly services: readonly [{
|
|
6
|
+
readonly apiClass: 'API';
|
|
7
|
+
readonly methods: readonly [{
|
|
8
|
+
readonly methodName: 'listBudgets';
|
|
9
|
+
readonly protoName: 'ListBudgets';
|
|
10
|
+
readonly paramsType: 'ListBudgetsRequest';
|
|
11
|
+
readonly returnType: 'ListBudgetsResponse';
|
|
12
|
+
readonly isList: true;
|
|
13
|
+
readonly paginationType: 'offset';
|
|
14
|
+
readonly pageParamKey: 'page';
|
|
15
|
+
readonly listItemType: 'Budget';
|
|
16
|
+
readonly isPrivate: false;
|
|
17
|
+
readonly description: '"';
|
|
18
|
+
}, {
|
|
19
|
+
readonly methodName: 'getBudget';
|
|
20
|
+
readonly protoName: 'GetBudget';
|
|
21
|
+
readonly paramsType: 'GetBudgetRequest';
|
|
22
|
+
readonly returnType: 'Budget';
|
|
23
|
+
readonly isList: false;
|
|
24
|
+
readonly paginationType: 'none';
|
|
25
|
+
readonly isPrivate: false;
|
|
26
|
+
readonly description: '"';
|
|
27
|
+
}];
|
|
28
|
+
}];
|
|
29
|
+
};
|
|
30
|
+
export type QueriesMetadata = typeof queriesMetadata;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/v2/metadata.gen.ts
|
|
2
|
+
const queriesMetadata = {
|
|
3
|
+
namespace: "billing",
|
|
4
|
+
version: "v2",
|
|
5
|
+
folderName: "billingv2",
|
|
6
|
+
services: [{
|
|
7
|
+
apiClass: "API",
|
|
8
|
+
methods: [{
|
|
9
|
+
methodName: "listBudgets",
|
|
10
|
+
protoName: "ListBudgets",
|
|
11
|
+
paramsType: "ListBudgetsRequest",
|
|
12
|
+
returnType: "ListBudgetsResponse",
|
|
13
|
+
isList: true,
|
|
14
|
+
paginationType: "offset",
|
|
15
|
+
pageParamKey: "page",
|
|
16
|
+
listItemType: "Budget",
|
|
17
|
+
isPrivate: false,
|
|
18
|
+
description: "\""
|
|
19
|
+
}, {
|
|
20
|
+
methodName: "getBudget",
|
|
21
|
+
protoName: "GetBudget",
|
|
22
|
+
paramsType: "GetBudgetRequest",
|
|
23
|
+
returnType: "Budget",
|
|
24
|
+
isList: false,
|
|
25
|
+
paginationType: "none",
|
|
26
|
+
isPrivate: false,
|
|
27
|
+
description: "\""
|
|
28
|
+
}]
|
|
29
|
+
}]
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { queriesMetadata };
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { Money } from '@scaleway/sdk-client';
|
|
2
|
+
export type BudgetAlertNotificationType = 'unknown_type' | 'sms' | 'email' | 'webhook';
|
|
3
|
+
export interface BudgetAlertNotification {
|
|
4
|
+
/**
|
|
5
|
+
* Alert notification's ID.
|
|
6
|
+
*/
|
|
7
|
+
id: string;
|
|
8
|
+
/**
|
|
9
|
+
* The creation date of the alert notification.
|
|
10
|
+
*/
|
|
11
|
+
createdAt?: Date;
|
|
12
|
+
/**
|
|
13
|
+
* The last modification date of the alert notification.
|
|
14
|
+
*/
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
/**
|
|
17
|
+
* Kind of notification.
|
|
18
|
+
*/
|
|
19
|
+
type: BudgetAlertNotificationType;
|
|
20
|
+
/**
|
|
21
|
+
* List of recipients for this alert.
|
|
22
|
+
*/
|
|
23
|
+
recipients: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface BudgetAlert {
|
|
26
|
+
/**
|
|
27
|
+
* Alert's ID.
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* The creation date of the alert.
|
|
32
|
+
*/
|
|
33
|
+
createdAt?: Date;
|
|
34
|
+
/**
|
|
35
|
+
* The last modification date of the alert.
|
|
36
|
+
*/
|
|
37
|
+
updatedAt?: Date;
|
|
38
|
+
/**
|
|
39
|
+
* Percentage threshold of the budget's limit for which the alert is triggered.
|
|
40
|
+
*/
|
|
41
|
+
threshold: number;
|
|
42
|
+
/**
|
|
43
|
+
* Notifications to send when the alert is triggered.
|
|
44
|
+
*/
|
|
45
|
+
notifications: BudgetAlertNotification[];
|
|
46
|
+
}
|
|
47
|
+
export interface Budget {
|
|
48
|
+
/**
|
|
49
|
+
* Budget's ID.
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* The creation date of the budget.
|
|
54
|
+
*/
|
|
55
|
+
createdAt?: Date;
|
|
56
|
+
/**
|
|
57
|
+
* The last modification date of the budget.
|
|
58
|
+
*/
|
|
59
|
+
updatedAt?: Date;
|
|
60
|
+
/**
|
|
61
|
+
* The organization ID of the budget.
|
|
62
|
+
*/
|
|
63
|
+
organizationId: string;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the budget is enabled or not.
|
|
66
|
+
*/
|
|
67
|
+
enabled: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Cost limit for this budget.
|
|
70
|
+
*/
|
|
71
|
+
consumptionLimit?: Money;
|
|
72
|
+
/**
|
|
73
|
+
* Alerts defined for this budget.
|
|
74
|
+
*/
|
|
75
|
+
alerts: BudgetAlert[];
|
|
76
|
+
}
|
|
77
|
+
export type CreateBudgetAlertNotificationRequest = {
|
|
78
|
+
/**
|
|
79
|
+
* The ID of the budget alert to create notification for.
|
|
80
|
+
*/
|
|
81
|
+
budgetAlertId: string;
|
|
82
|
+
/**
|
|
83
|
+
* List of phone numbers to receive sms notifications.
|
|
84
|
+
*
|
|
85
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
86
|
+
*/
|
|
87
|
+
smsPhoneNumbers?: string[];
|
|
88
|
+
/**
|
|
89
|
+
* List of email addresses to receive email notifications.
|
|
90
|
+
*
|
|
91
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
92
|
+
*/
|
|
93
|
+
emailAddresses?: string[];
|
|
94
|
+
/**
|
|
95
|
+
* List of webhook url to receive webhook notifications.
|
|
96
|
+
*
|
|
97
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
98
|
+
*/
|
|
99
|
+
webhookUrls?: string[];
|
|
100
|
+
};
|
|
101
|
+
export type CreateBudgetAlertRequest = {
|
|
102
|
+
/**
|
|
103
|
+
* The ID of the budget to create alert for.
|
|
104
|
+
*/
|
|
105
|
+
budgetId: string;
|
|
106
|
+
/**
|
|
107
|
+
* Threshold above which the alert is sent.
|
|
108
|
+
*/
|
|
109
|
+
threshold: number;
|
|
110
|
+
};
|
|
111
|
+
export type CreateBudgetRequest = {
|
|
112
|
+
/**
|
|
113
|
+
* The Organization ID of the budget.
|
|
114
|
+
*/
|
|
115
|
+
organizationId?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Cost limit for the budget.
|
|
118
|
+
*/
|
|
119
|
+
consumptionLimit: number;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the budget is enabled or not.
|
|
122
|
+
*/
|
|
123
|
+
enabled: boolean;
|
|
124
|
+
};
|
|
125
|
+
export type DeleteBudgetAlertNotificationRequest = {
|
|
126
|
+
/**
|
|
127
|
+
* The ID of the budget alert notification to delete.
|
|
128
|
+
*/
|
|
129
|
+
budgetAlertNotificationId: string;
|
|
130
|
+
};
|
|
131
|
+
export type DeleteBudgetAlertRequest = {
|
|
132
|
+
/**
|
|
133
|
+
* The ID of the budget alert to delete.
|
|
134
|
+
*/
|
|
135
|
+
budgetAlertId: string;
|
|
136
|
+
};
|
|
137
|
+
export type DeleteBudgetRequest = {
|
|
138
|
+
/**
|
|
139
|
+
* The ID of the budget to delete.
|
|
140
|
+
*/
|
|
141
|
+
budgetId: string;
|
|
142
|
+
};
|
|
143
|
+
export type GetBudgetRequest = {
|
|
144
|
+
/**
|
|
145
|
+
* The ID of the budget.
|
|
146
|
+
*/
|
|
147
|
+
budgetId: string;
|
|
148
|
+
};
|
|
149
|
+
export type ListBudgetsRequest = {
|
|
150
|
+
/**
|
|
151
|
+
* Filter by organization ID.
|
|
152
|
+
*/
|
|
153
|
+
organizationId?: string;
|
|
154
|
+
/**
|
|
155
|
+
* Page number.
|
|
156
|
+
*/
|
|
157
|
+
page?: number;
|
|
158
|
+
/**
|
|
159
|
+
* Positive integer to select the number of items to return.
|
|
160
|
+
*/
|
|
161
|
+
pageSize?: number;
|
|
162
|
+
};
|
|
163
|
+
export interface ListBudgetsResponse {
|
|
164
|
+
/**
|
|
165
|
+
* Detailed budget list.
|
|
166
|
+
*/
|
|
167
|
+
budgets: Budget[];
|
|
168
|
+
/**
|
|
169
|
+
* Total number of items.
|
|
170
|
+
*/
|
|
171
|
+
totalCount: number;
|
|
172
|
+
}
|
|
173
|
+
export type UpdateBudgetAlertNotificationRequest = {
|
|
174
|
+
/**
|
|
175
|
+
* The ID of the budget alert notification to update.
|
|
176
|
+
*/
|
|
177
|
+
budgetAlertNotificationId: string;
|
|
178
|
+
/**
|
|
179
|
+
* List of phone numbers to receive sms notifications.
|
|
180
|
+
*
|
|
181
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
182
|
+
*/
|
|
183
|
+
smsPhoneNumbers?: string[];
|
|
184
|
+
/**
|
|
185
|
+
* List of email addresses to receive email notifications.
|
|
186
|
+
*
|
|
187
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
188
|
+
*/
|
|
189
|
+
emailAddresses?: string[];
|
|
190
|
+
/**
|
|
191
|
+
* List of webhook url to receive webhook notifications.
|
|
192
|
+
*
|
|
193
|
+
* One-of ('recipientType'): at most one of 'smsPhoneNumbers', 'emailAddresses', 'webhookUrls' could be set.
|
|
194
|
+
*/
|
|
195
|
+
webhookUrls?: string[];
|
|
196
|
+
};
|
|
197
|
+
export type UpdateBudgetAlertRequest = {
|
|
198
|
+
/**
|
|
199
|
+
* The ID of the budget alert to update.
|
|
200
|
+
*/
|
|
201
|
+
budgetAlertId: string;
|
|
202
|
+
/**
|
|
203
|
+
* Threshold above which the alert is sent.
|
|
204
|
+
*/
|
|
205
|
+
threshold: number;
|
|
206
|
+
};
|
|
207
|
+
export type UpdateBudgetRequest = {
|
|
208
|
+
/**
|
|
209
|
+
* The ID of the budget to update.
|
|
210
|
+
*/
|
|
211
|
+
budgetId: string;
|
|
212
|
+
/**
|
|
213
|
+
* Cost limit for the budget.
|
|
214
|
+
*/
|
|
215
|
+
consumptionLimit?: number;
|
|
216
|
+
/**
|
|
217
|
+
* Whether the budget will be enabled or not.
|
|
218
|
+
*/
|
|
219
|
+
enabled?: boolean;
|
|
220
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CreateBudgetAlertRequest: {
|
|
2
|
+
threshold: {
|
|
3
|
+
greaterThanOrEqual: number;
|
|
4
|
+
lessThanOrEqual: number;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export declare const UpdateBudgetAlertRequest: {
|
|
8
|
+
threshold: {
|
|
9
|
+
greaterThanOrEqual: number;
|
|
10
|
+
lessThanOrEqual: number;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
UpdateBudgetAlertRequest: () => UpdateBudgetAlertRequest
|
|
6
|
+
});
|
|
7
|
+
const CreateBudgetAlertRequest = { threshold: {
|
|
8
|
+
greaterThanOrEqual: 1,
|
|
9
|
+
lessThanOrEqual: 100
|
|
10
|
+
} };
|
|
11
|
+
const UpdateBudgetAlertRequest = { threshold: {
|
|
12
|
+
greaterThanOrEqual: 1,
|
|
13
|
+
lessThanOrEqual: 100
|
|
14
|
+
} };
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CreateBudgetAlertRequest, UpdateBudgetAlertRequest, validation_rules_gen_exports };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { API as ParentAPI } from '@scaleway/sdk-client';
|
|
2
|
-
import type { Discount, DownloadInvoiceRequest, ExportInvoicesRequest, GetInvoiceRequest, Invoice, ListConsumptionsRequest, ListConsumptionsResponse, ListDiscountsRequest, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesResponse, ListTaxesRequest, ListTaxesResponse, RedeemCouponRequest } from './types.gen.js';
|
|
2
|
+
import type { Discount, DownloadInvoiceRequest, ExportInvoicesRequest, FinOpsApiListChargesRequest, GetInvoiceRequest, Invoice, ListChargesResponse, ListConsumptionsRequest, ListConsumptionsResponse, ListDiscountsRequest, ListDiscountsResponse, ListInvoicesRequest, ListInvoicesResponse, ListTaxesRequest, ListTaxesResponse, RedeemCouponRequest } from './types.gen.js';
|
|
3
3
|
/**
|
|
4
4
|
* Billing API.
|
|
5
5
|
|
|
@@ -82,3 +82,15 @@ export declare class API extends ParentAPI {
|
|
|
82
82
|
*/
|
|
83
83
|
redeemCoupon: (request: Readonly<RedeemCouponRequest>) => Promise<Discount>;
|
|
84
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
|
+
}
|
package/dist/v2beta1/api.gen.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
|
|
1
|
+
import { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
|
|
2
2
|
import { API as API$1, enrichForPagination, resolveOneOf, urlParams, validatePathParam } from "@scaleway/sdk-client";
|
|
3
3
|
//#region src/v2beta1/api.gen.ts
|
|
4
4
|
/**
|
|
@@ -64,5 +64,18 @@ var API = class extends API$1 {
|
|
|
64
64
|
}, unmarshalDiscount);
|
|
65
65
|
}
|
|
66
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
|
+
};
|
|
67
80
|
//#endregion
|
|
68
|
-
export { API };
|
|
81
|
+
export { API, FinOpsAPI };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { API, } from './api.gen.js';
|
|
1
|
+
export { API, FinOpsAPI, } from './api.gen.js';
|
|
2
2
|
export * from './marshalling.gen.js';
|
|
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';
|
|
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';
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse } from "./marshalling.gen.js";
|
|
3
|
-
import { API } from "./api.gen.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";
|
|
4
5
|
//#region src/v2beta1/index.gen.ts
|
|
5
6
|
var index_gen_exports = /* @__PURE__ */ __exportAll({
|
|
6
7
|
API: () => API,
|
|
8
|
+
FinOpsAPI: () => FinOpsAPI,
|
|
9
|
+
ValidationRules: () => validation_rules_gen_exports,
|
|
7
10
|
unmarshalDiscount: () => unmarshalDiscount,
|
|
8
11
|
unmarshalInvoice: () => unmarshalInvoice,
|
|
12
|
+
unmarshalListChargesResponse: () => unmarshalListChargesResponse,
|
|
9
13
|
unmarshalListConsumptionsResponse: () => unmarshalListConsumptionsResponse,
|
|
10
14
|
unmarshalListDiscountsResponse: () => unmarshalListDiscountsResponse,
|
|
11
15
|
unmarshalListInvoicesResponse: () => unmarshalListInvoicesResponse,
|
|
12
16
|
unmarshalListTaxesResponse: () => unmarshalListTaxesResponse
|
|
13
17
|
});
|
|
14
18
|
//#endregion
|
|
15
|
-
export { API, index_gen_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
|
|
19
|
+
export { API, FinOpsAPI, validation_rules_gen_exports as ValidationRules, index_gen_exports, unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Discount, Invoice, ListConsumptionsResponse, ListDiscountsResponse, ListInvoicesResponse, ListTaxesResponse } from './types.gen.js';
|
|
1
|
+
import type { Discount, Invoice, ListChargesResponse, ListConsumptionsResponse, ListDiscountsResponse, ListInvoicesResponse, ListTaxesResponse } from './types.gen.js';
|
|
2
2
|
export declare const unmarshalDiscount: (data: unknown) => Discount;
|
|
3
3
|
export declare const unmarshalInvoice: (data: unknown) => Invoice;
|
|
4
|
+
export declare const unmarshalListChargesResponse: (data: unknown) => ListChargesResponse;
|
|
4
5
|
export declare const unmarshalListConsumptionsResponse: (data: unknown) => ListConsumptionsResponse;
|
|
5
6
|
export declare const unmarshalListDiscountsResponse: (data: unknown) => ListDiscountsResponse;
|
|
6
7
|
export declare const unmarshalListInvoicesResponse: (data: unknown) => ListInvoicesResponse;
|
|
@@ -51,6 +51,28 @@ const unmarshalInvoice = (data) => {
|
|
|
51
51
|
type: data.type
|
|
52
52
|
};
|
|
53
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
|
+
price: data.price ? unmarshalMoney(data.price) : void 0,
|
|
61
|
+
projectId: data.project_id,
|
|
62
|
+
resourceId: data.resource_id,
|
|
63
|
+
resourceName: data.resource_name,
|
|
64
|
+
sku: data.sku,
|
|
65
|
+
startDate: unmarshalDate(data.start_date),
|
|
66
|
+
updatedAt: unmarshalDate(data.updated_at)
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
const unmarshalListChargesResponse = (data) => {
|
|
70
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListChargesResponse' failed as data isn't a dictionary.`);
|
|
71
|
+
return {
|
|
72
|
+
charges: unmarshalArrayOfObject(data.charges, unmarshalCharge),
|
|
73
|
+
nextPageToken: data.next_page_token
|
|
74
|
+
};
|
|
75
|
+
};
|
|
54
76
|
const unmarshalListConsumptionsResponseConsumption = (data) => {
|
|
55
77
|
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ListConsumptionsResponseConsumption' failed as data isn't a dictionary.`);
|
|
56
78
|
return {
|
|
@@ -106,4 +128,4 @@ const unmarshalListTaxesResponse = (data) => {
|
|
|
106
128
|
};
|
|
107
129
|
};
|
|
108
130
|
//#endregion
|
|
109
|
-
export { unmarshalDiscount, unmarshalInvoice, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
|
|
131
|
+
export { unmarshalDiscount, unmarshalInvoice, unmarshalListChargesResponse, unmarshalListConsumptionsResponse, unmarshalListDiscountsResponse, unmarshalListInvoicesResponse, unmarshalListTaxesResponse };
|
|
@@ -1,62 +1,77 @@
|
|
|
1
1
|
export declare const queriesMetadata: {
|
|
2
|
-
readonly namespace:
|
|
3
|
-
readonly version:
|
|
4
|
-
readonly folderName:
|
|
2
|
+
readonly namespace: 'billing';
|
|
3
|
+
readonly version: 'v2beta1';
|
|
4
|
+
readonly folderName: 'billingv2beta1';
|
|
5
5
|
readonly services: readonly [{
|
|
6
|
-
readonly apiClass:
|
|
6
|
+
readonly apiClass: 'API';
|
|
7
7
|
readonly methods: readonly [{
|
|
8
|
-
readonly methodName:
|
|
9
|
-
readonly protoName:
|
|
10
|
-
readonly paramsType:
|
|
11
|
-
readonly returnType:
|
|
8
|
+
readonly methodName: 'listConsumptions';
|
|
9
|
+
readonly protoName: 'ListConsumptions';
|
|
10
|
+
readonly paramsType: 'ListConsumptionsRequest';
|
|
11
|
+
readonly returnType: 'ListConsumptionsResponse';
|
|
12
12
|
readonly isList: true;
|
|
13
|
-
readonly paginationType:
|
|
14
|
-
readonly pageParamKey:
|
|
15
|
-
readonly listItemType:
|
|
13
|
+
readonly paginationType: 'offset';
|
|
14
|
+
readonly pageParamKey: 'page';
|
|
15
|
+
readonly listItemType: 'ListConsumptionsResponseConsumption';
|
|
16
16
|
readonly isPrivate: false;
|
|
17
|
-
readonly description: "
|
|
17
|
+
readonly description: '"';
|
|
18
18
|
}, {
|
|
19
|
-
readonly methodName:
|
|
20
|
-
readonly protoName:
|
|
21
|
-
readonly paramsType:
|
|
22
|
-
readonly returnType:
|
|
19
|
+
readonly methodName: 'listTaxes';
|
|
20
|
+
readonly protoName: 'ListTaxes';
|
|
21
|
+
readonly paramsType: 'ListTaxesRequest';
|
|
22
|
+
readonly returnType: 'ListTaxesResponse';
|
|
23
23
|
readonly isList: true;
|
|
24
|
-
readonly paginationType:
|
|
25
|
-
readonly pageParamKey:
|
|
26
|
-
readonly listItemType:
|
|
24
|
+
readonly paginationType: 'offset';
|
|
25
|
+
readonly pageParamKey: 'page';
|
|
26
|
+
readonly listItemType: 'ListTaxesResponseTax';
|
|
27
27
|
readonly isPrivate: false;
|
|
28
|
-
readonly description: "
|
|
28
|
+
readonly description: '"';
|
|
29
29
|
}, {
|
|
30
|
-
readonly methodName:
|
|
31
|
-
readonly protoName:
|
|
32
|
-
readonly paramsType:
|
|
33
|
-
readonly returnType:
|
|
30
|
+
readonly methodName: 'listInvoices';
|
|
31
|
+
readonly protoName: 'ListInvoices';
|
|
32
|
+
readonly paramsType: 'ListInvoicesRequest';
|
|
33
|
+
readonly returnType: 'ListInvoicesResponse';
|
|
34
34
|
readonly isList: true;
|
|
35
|
-
readonly paginationType:
|
|
36
|
-
readonly pageParamKey:
|
|
37
|
-
readonly listItemType:
|
|
35
|
+
readonly paginationType: 'offset';
|
|
36
|
+
readonly pageParamKey: 'page';
|
|
37
|
+
readonly listItemType: 'Invoice';
|
|
38
38
|
readonly isPrivate: false;
|
|
39
|
-
readonly description: "
|
|
39
|
+
readonly description: '"';
|
|
40
40
|
}, {
|
|
41
|
-
readonly methodName:
|
|
42
|
-
readonly protoName:
|
|
43
|
-
readonly paramsType:
|
|
44
|
-
readonly returnType:
|
|
41
|
+
readonly methodName: 'getInvoice';
|
|
42
|
+
readonly protoName: 'GetInvoice';
|
|
43
|
+
readonly paramsType: 'GetInvoiceRequest';
|
|
44
|
+
readonly returnType: 'Invoice';
|
|
45
45
|
readonly isList: false;
|
|
46
|
-
readonly paginationType:
|
|
46
|
+
readonly paginationType: 'none';
|
|
47
47
|
readonly isPrivate: false;
|
|
48
|
-
readonly description: "
|
|
48
|
+
readonly description: '"';
|
|
49
49
|
}, {
|
|
50
|
-
readonly methodName:
|
|
51
|
-
readonly protoName:
|
|
52
|
-
readonly paramsType:
|
|
53
|
-
readonly returnType:
|
|
50
|
+
readonly methodName: 'listDiscounts';
|
|
51
|
+
readonly protoName: 'ListDiscounts';
|
|
52
|
+
readonly paramsType: 'ListDiscountsRequest';
|
|
53
|
+
readonly returnType: 'ListDiscountsResponse';
|
|
54
54
|
readonly isList: true;
|
|
55
|
-
readonly paginationType:
|
|
56
|
-
readonly pageParamKey:
|
|
57
|
-
readonly listItemType:
|
|
55
|
+
readonly paginationType: 'offset';
|
|
56
|
+
readonly pageParamKey: 'page';
|
|
57
|
+
readonly listItemType: 'Discount';
|
|
58
58
|
readonly isPrivate: false;
|
|
59
|
-
readonly description: "
|
|
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: '"';
|
|
60
75
|
}];
|
|
61
76
|
}];
|
|
62
77
|
};
|
|
@@ -65,6 +65,21 @@ const queriesMetadata = {
|
|
|
65
65
|
description: "\""
|
|
66
66
|
}
|
|
67
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
|
+
}]
|
|
68
83
|
}]
|
|
69
84
|
};
|
|
70
85
|
//#endregion
|
|
@@ -5,6 +5,7 @@ export type DownloadInvoiceRequestFileType = 'pdf';
|
|
|
5
5
|
export type ExportInvoicesRequestFileType = 'csv';
|
|
6
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
7
|
export type InvoiceType = 'unknown_type' | 'periodic' | 'purchase';
|
|
8
|
+
export type ListChargesRequestOrderBy = 'start_date_asc' | 'start_date_desc';
|
|
8
9
|
export type ListConsumptionsRequestOrderBy = 'updated_at_desc' | 'updated_at_asc' | 'category_name_desc' | 'category_name_asc';
|
|
9
10
|
export type ListDiscountsRequestOrderBy = 'creation_date_desc' | 'creation_date_asc' | 'start_date_desc' | 'start_date_asc' | 'stop_date_desc' | 'stop_date_asc';
|
|
10
11
|
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';
|
|
@@ -29,6 +30,48 @@ export interface DiscountFilter {
|
|
|
29
30
|
*/
|
|
30
31
|
exclude: boolean;
|
|
31
32
|
}
|
|
33
|
+
export interface Charge {
|
|
34
|
+
/**
|
|
35
|
+
* ID of the charged organization.
|
|
36
|
+
*/
|
|
37
|
+
organizationId: string;
|
|
38
|
+
/**
|
|
39
|
+
* ID of the charged project.
|
|
40
|
+
*/
|
|
41
|
+
projectId: string;
|
|
42
|
+
/**
|
|
43
|
+
* ID of the SKU the charge is priced with.
|
|
44
|
+
*/
|
|
45
|
+
sku: string;
|
|
46
|
+
/**
|
|
47
|
+
* ID of the invoice including the charge.
|
|
48
|
+
*/
|
|
49
|
+
invoiceId: string;
|
|
50
|
+
/**
|
|
51
|
+
* ID of the resource that incurs the charge.
|
|
52
|
+
*/
|
|
53
|
+
resourceId: string;
|
|
54
|
+
/**
|
|
55
|
+
* Optional display name assigned to the resource that incurs the charge.
|
|
56
|
+
*/
|
|
57
|
+
resourceName?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Price of the charge.
|
|
60
|
+
*/
|
|
61
|
+
price?: Money;
|
|
62
|
+
/**
|
|
63
|
+
* Start date of the charge.
|
|
64
|
+
*/
|
|
65
|
+
startDate?: Date;
|
|
66
|
+
/**
|
|
67
|
+
* End date of the charge, included.
|
|
68
|
+
*/
|
|
69
|
+
endDate?: Date;
|
|
70
|
+
/**
|
|
71
|
+
* Date the charge was last updated.
|
|
72
|
+
*/
|
|
73
|
+
updatedAt?: Date;
|
|
74
|
+
}
|
|
32
75
|
export interface ListConsumptionsResponseConsumption {
|
|
33
76
|
/**
|
|
34
77
|
* Monetary value of the consumption.
|
|
@@ -240,12 +283,72 @@ export type ExportInvoicesRequest = {
|
|
|
240
283
|
*/
|
|
241
284
|
fileType?: ExportInvoicesRequestFileType;
|
|
242
285
|
};
|
|
286
|
+
export type FinOpsApiListChargesRequest = {
|
|
287
|
+
/**
|
|
288
|
+
* Sort order of charges in the response.
|
|
289
|
+
*/
|
|
290
|
+
orderBy?: ListChargesRequestOrderBy;
|
|
291
|
+
/**
|
|
292
|
+
* Token returned by previous call to list next paginated charges, omitted for first page.
|
|
293
|
+
*/
|
|
294
|
+
pageToken?: string;
|
|
295
|
+
/**
|
|
296
|
+
* Number of charges to return per page.
|
|
297
|
+
*/
|
|
298
|
+
pageSize?: number;
|
|
299
|
+
/**
|
|
300
|
+
* Minimum start date of charges to filter for, defaults to the start of the billing period.
|
|
301
|
+
*/
|
|
302
|
+
startDateAfter?: Date;
|
|
303
|
+
/**
|
|
304
|
+
* Maximum end date of charges to filter for, defaults to the end of the billing period.
|
|
305
|
+
*/
|
|
306
|
+
endDateBefore?: Date;
|
|
307
|
+
/**
|
|
308
|
+
* Invoice IDs to filter for, only charges from these invoices will be returned.
|
|
309
|
+
*/
|
|
310
|
+
invoiceIds?: string[];
|
|
311
|
+
/**
|
|
312
|
+
* Organization ID to filter for, only charges for this organization will be returned.
|
|
313
|
+
*/
|
|
314
|
+
organizationId?: string;
|
|
315
|
+
/**
|
|
316
|
+
* Project IDs to filter for, only charges for these projects will be returned.
|
|
317
|
+
*/
|
|
318
|
+
projectIds?: string[];
|
|
319
|
+
/**
|
|
320
|
+
* Resource IDs to filter for, only charges for these resources will be returned.
|
|
321
|
+
*/
|
|
322
|
+
resourceIds?: string[];
|
|
323
|
+
/**
|
|
324
|
+
* Resource display names to filter for, only charges for these resources will be returned.
|
|
325
|
+
*/
|
|
326
|
+
resourceNames?: string[];
|
|
327
|
+
/**
|
|
328
|
+
* SKU IDs to filter for, only charges for these SKUs will be returned.
|
|
329
|
+
*/
|
|
330
|
+
skus?: string[];
|
|
331
|
+
/**
|
|
332
|
+
* Clamp charges to the requested time range.
|
|
333
|
+
*/
|
|
334
|
+
clampToTimeRange?: boolean;
|
|
335
|
+
};
|
|
243
336
|
export type GetInvoiceRequest = {
|
|
244
337
|
/**
|
|
245
338
|
* Invoice ID.
|
|
246
339
|
*/
|
|
247
340
|
invoiceId: string;
|
|
248
341
|
};
|
|
342
|
+
export interface ListChargesResponse {
|
|
343
|
+
/**
|
|
344
|
+
* Paginated matching charges.
|
|
345
|
+
*/
|
|
346
|
+
charges: Charge[];
|
|
347
|
+
/**
|
|
348
|
+
* Page token to use with following call to keep listing charges if there are more.
|
|
349
|
+
*/
|
|
350
|
+
nextPageToken?: string;
|
|
351
|
+
}
|
|
249
352
|
export type ListConsumptionsRequest = {
|
|
250
353
|
/**
|
|
251
354
|
* Order consumptions list in the response by their update date.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
//#region src/v2beta1/validation-rules.gen.ts
|
|
3
|
+
var validation_rules_gen_exports = /* @__PURE__ */ __exportAll({ FinOpsApiListChargesRequest: () => FinOpsApiListChargesRequest });
|
|
4
|
+
const FinOpsApiListChargesRequest = { pageSize: {
|
|
5
|
+
greaterThanOrEqual: 1,
|
|
6
|
+
lessThanOrEqual: 1e3
|
|
7
|
+
} };
|
|
8
|
+
//#endregion
|
|
9
|
+
export { FinOpsApiListChargesRequest, validation_rules_gen_exports };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-billing",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Scaleway SDK billing",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@scaleway/random-name": "5.1.4",
|
|
35
|
-
"@scaleway/sdk-std": "2.4.
|
|
35
|
+
"@scaleway/sdk-std": "2.4.2"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@repo/configs": "^0.1.1",
|
|
39
|
-
"@scaleway/sdk-client": "^2.
|
|
39
|
+
"@scaleway/sdk-client": "^2.4.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@scaleway/sdk-client": "^2.
|
|
42
|
+
"@scaleway/sdk-client": "^2.4.0"
|
|
43
43
|
},
|
|
44
44
|
"engines": {
|
|
45
|
-
"node": ">=20.
|
|
45
|
+
"node": ">=20.20.2"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"package:check": "pnpm publint",
|