@scaleway/sdk-environmental-footprint 2.5.1 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/index.gen.js +2 -4
- package/dist/v1alpha1/api.gen.js +45 -72
- package/dist/v1alpha1/index.gen.js +9 -7
- package/dist/v1alpha1/marshalling.gen.js +56 -88
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -83,6 +83,7 @@ const api = new EnvironmentalFootprint.v1.API(client)
|
|
|
83
83
|
## Support
|
|
84
84
|
|
|
85
85
|
We love feedback! Feel free to reach us on:
|
|
86
|
+
|
|
86
87
|
- [Scaleway Slack community](https://slack.scaleway.com/) - Join us on [#opensource](https://scaleway-community.slack.com/app_redirect?channel=opensource)
|
|
87
88
|
- [GitHub Issues](https://github.com/scaleway/scaleway-sdk-js/issues)
|
|
88
89
|
|
|
@@ -93,4 +94,3 @@ This repository is at its early stage and is still in active development. If you
|
|
|
93
94
|
## License
|
|
94
95
|
|
|
95
96
|
This project is Apache 2.0 licensed. See the [LICENSE](https://github.com/scaleway/scaleway-sdk-js/blob/master/LICENSE) file for details.
|
|
96
|
-
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __exportAll = (all, no_symbols) => {
|
|
3
|
+
let target = {};
|
|
4
|
+
for (var name in all) __defProp(target, name, {
|
|
5
|
+
get: all[name],
|
|
6
|
+
enumerable: true
|
|
7
|
+
});
|
|
8
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
export { __exportAll };
|
package/dist/index.gen.js
CHANGED
package/dist/v1alpha1/api.gen.js
CHANGED
|
@@ -1,74 +1,47 @@
|
|
|
1
|
+
import { marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse, unmarshalImpactReportAvailability } from "./marshalling.gen.js";
|
|
1
2
|
import { API, urlParams } from "@scaleway/sdk-client";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
responseType: "blob"
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
/**
|
|
49
|
-
* Retrieve detailed impact data. Retrieve detailed impact data for your Scaleway projects within a specified date range. Filter by project ID, region, zone, service category, and/or product category.
|
|
50
|
-
*
|
|
51
|
-
* @param request - The request {@link UserApiGetImpactDataRequest}
|
|
52
|
-
* @returns A Promise of ImpactDataResponse
|
|
53
|
-
*/
|
|
54
|
-
getImpactData = (request = {}) => this.client.fetch(
|
|
55
|
-
{
|
|
56
|
-
method: "GET",
|
|
57
|
-
path: `/environmental-footprint/v1alpha1/data/query`,
|
|
58
|
-
urlParams: urlParams(
|
|
59
|
-
["end_date", request.endDate],
|
|
60
|
-
["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
|
|
61
|
-
["product_categories", request.productCategories],
|
|
62
|
-
["project_ids", request.projectIds],
|
|
63
|
-
["regions", request.regions],
|
|
64
|
-
["service_categories", request.serviceCategories],
|
|
65
|
-
["start_date", request.startDate],
|
|
66
|
-
["zones", request.zones]
|
|
67
|
-
)
|
|
68
|
-
},
|
|
69
|
-
unmarshalImpactDataResponse
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
export {
|
|
73
|
-
UserAPI
|
|
3
|
+
var jsonContentHeaders = { "Content-Type": "application/json; charset=utf-8" };
|
|
4
|
+
/**
|
|
5
|
+
* Environmental Footprint API.
|
|
6
|
+
|
|
7
|
+
Access and download impact reports and impact data for your Scaleway projects. Our API provides key metrics such as estimated carbon emissions and water usage to help monitor your environmental footprint.
|
|
8
|
+
*/
|
|
9
|
+
var UserAPI = class extends API {
|
|
10
|
+
/**
|
|
11
|
+
* Get available impact reports. Returns a list of dates of available impact reports.
|
|
12
|
+
*
|
|
13
|
+
* @param request - The request {@link UserApiGetImpactReportAvailabilityRequest}
|
|
14
|
+
* @returns A Promise of ImpactReportAvailability
|
|
15
|
+
*/
|
|
16
|
+
getImpactReportAvailability = (request = {}) => this.client.fetch({
|
|
17
|
+
method: "GET",
|
|
18
|
+
path: `/environmental-footprint/v1alpha1/reports/availability`,
|
|
19
|
+
urlParams: urlParams(["end_date", request.endDate], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId], ["start_date", request.startDate])
|
|
20
|
+
}, unmarshalImpactReportAvailability);
|
|
21
|
+
/**
|
|
22
|
+
* Download PDF impact report. Download a Scaleway impact PDF report with detailed impact data for your Scaleway projects.
|
|
23
|
+
*
|
|
24
|
+
* @param request - The request {@link UserApiDownloadImpactReportRequest}
|
|
25
|
+
* @returns A Promise of Blob
|
|
26
|
+
*/
|
|
27
|
+
downloadImpactReport = (request = {}) => this.client.fetch({
|
|
28
|
+
body: JSON.stringify(marshalUserApiDownloadImpactReportRequest(request, this.client.settings)),
|
|
29
|
+
headers: jsonContentHeaders,
|
|
30
|
+
method: "POST",
|
|
31
|
+
path: `/environmental-footprint/v1alpha1/reports/download`,
|
|
32
|
+
urlParams: urlParams(["dl", 1], ["date", request.date], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId], ["type", request.type]),
|
|
33
|
+
responseType: "blob"
|
|
34
|
+
});
|
|
35
|
+
/**
|
|
36
|
+
* Retrieve detailed impact data. Retrieve detailed impact data for your Scaleway projects within a specified date range. Filter by project ID, region, zone, service category, and/or product category.
|
|
37
|
+
*
|
|
38
|
+
* @param request - The request {@link UserApiGetImpactDataRequest}
|
|
39
|
+
* @returns A Promise of ImpactDataResponse
|
|
40
|
+
*/
|
|
41
|
+
getImpactData = (request = {}) => this.client.fetch({
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: `/environmental-footprint/v1alpha1/data/query`,
|
|
44
|
+
urlParams: urlParams(["end_date", request.endDate], ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId], ["product_categories", request.productCategories], ["project_ids", request.projectIds], ["regions", request.regions], ["service_categories", request.serviceCategories], ["start_date", request.startDate], ["zones", request.zones])
|
|
45
|
+
}, unmarshalImpactDataResponse);
|
|
74
46
|
};
|
|
47
|
+
export { UserAPI };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse, unmarshalImpactReportAvailability } from "./marshalling.gen.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import { UserAPI } from "./api.gen.js";
|
|
4
|
+
var index_gen_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
UserAPI: () => UserAPI,
|
|
6
|
+
marshalUserApiDownloadImpactReportRequest: () => marshalUserApiDownloadImpactReportRequest,
|
|
7
|
+
unmarshalImpactDataResponse: () => unmarshalImpactDataResponse,
|
|
8
|
+
unmarshalImpactReportAvailability: () => unmarshalImpactReportAvailability
|
|
9
|
+
});
|
|
10
|
+
export { index_gen_exports };
|
|
@@ -1,95 +1,63 @@
|
|
|
1
|
-
import { isJSONObject,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
`Unmarshalling the type 'RegionImpact' failed as data isn't a dictionary.`
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
region: data.region,
|
|
46
|
-
totalRegionImpact: data.total_region_impact ? unmarshalImpact(data.total_region_impact) : void 0,
|
|
47
|
-
zones: unmarshalArrayOfObject(data.zones, unmarshalZoneImpact)
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
const unmarshalProjectImpact = (data) => {
|
|
51
|
-
if (!isJSONObject(data)) {
|
|
52
|
-
throw new TypeError(
|
|
53
|
-
`Unmarshalling the type 'ProjectImpact' failed as data isn't a dictionary.`
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
projectId: data.project_id,
|
|
58
|
-
regions: unmarshalArrayOfObject(data.regions, unmarshalRegionImpact),
|
|
59
|
-
totalProjectImpact: data.total_project_impact ? unmarshalImpact(data.total_project_impact) : void 0
|
|
60
|
-
};
|
|
1
|
+
import { isJSONObject, unmarshalArrayOfObject, unmarshalDate } from "@scaleway/sdk-client";
|
|
2
|
+
var unmarshalImpact = (data) => {
|
|
3
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'Impact' failed as data isn't a dictionary.`);
|
|
4
|
+
return {
|
|
5
|
+
kgCo2Equivalent: data.kg_co2_equivalent,
|
|
6
|
+
m3WaterUsage: data.m3_water_usage
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
var unmarshalSkuImpact = (data) => {
|
|
10
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'SkuImpact' failed as data isn't a dictionary.`);
|
|
11
|
+
return {
|
|
12
|
+
productCategory: data.product_category,
|
|
13
|
+
serviceCategory: data.service_category,
|
|
14
|
+
sku: data.sku,
|
|
15
|
+
totalSkuImpact: data.total_sku_impact ? unmarshalImpact(data.total_sku_impact) : void 0
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
var unmarshalZoneImpact = (data) => {
|
|
19
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ZoneImpact' failed as data isn't a dictionary.`);
|
|
20
|
+
return {
|
|
21
|
+
skus: unmarshalArrayOfObject(data.skus, unmarshalSkuImpact),
|
|
22
|
+
totalZoneImpact: data.total_zone_impact ? unmarshalImpact(data.total_zone_impact) : void 0,
|
|
23
|
+
zone: data.zone
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
var unmarshalRegionImpact = (data) => {
|
|
27
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'RegionImpact' failed as data isn't a dictionary.`);
|
|
28
|
+
return {
|
|
29
|
+
region: data.region,
|
|
30
|
+
totalRegionImpact: data.total_region_impact ? unmarshalImpact(data.total_region_impact) : void 0,
|
|
31
|
+
zones: unmarshalArrayOfObject(data.zones, unmarshalZoneImpact)
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
var unmarshalProjectImpact = (data) => {
|
|
35
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ProjectImpact' failed as data isn't a dictionary.`);
|
|
36
|
+
return {
|
|
37
|
+
projectId: data.project_id,
|
|
38
|
+
regions: unmarshalArrayOfObject(data.regions, unmarshalRegionImpact),
|
|
39
|
+
totalProjectImpact: data.total_project_impact ? unmarshalImpact(data.total_project_impact) : void 0
|
|
40
|
+
};
|
|
61
41
|
};
|
|
62
42
|
const unmarshalImpactDataResponse = (data) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
projects: unmarshalArrayOfObject(data.projects, unmarshalProjectImpact),
|
|
71
|
-
startDate: unmarshalDate(data.start_date),
|
|
72
|
-
totalImpact: data.total_impact ? unmarshalImpact(data.total_impact) : void 0
|
|
73
|
-
};
|
|
43
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ImpactDataResponse' failed as data isn't a dictionary.`);
|
|
44
|
+
return {
|
|
45
|
+
endDate: unmarshalDate(data.end_date),
|
|
46
|
+
projects: unmarshalArrayOfObject(data.projects, unmarshalProjectImpact),
|
|
47
|
+
startDate: unmarshalDate(data.start_date),
|
|
48
|
+
totalImpact: data.total_impact ? unmarshalImpact(data.total_impact) : void 0
|
|
49
|
+
};
|
|
74
50
|
};
|
|
75
51
|
const unmarshalImpactReportAvailability = (data) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
monthSummaryReports: unmarshalArrayOfObject(data.month_summary_reports, unmarshalDate),
|
|
83
|
-
yearlySummaryReports: unmarshalArrayOfObject(data.yearly_summary_reports, unmarshalDate)
|
|
84
|
-
};
|
|
52
|
+
if (!isJSONObject(data)) throw new TypeError(`Unmarshalling the type 'ImpactReportAvailability' failed as data isn't a dictionary.`);
|
|
53
|
+
return {
|
|
54
|
+
monthSummaryReports: unmarshalArrayOfObject(data.month_summary_reports, unmarshalDate),
|
|
55
|
+
yearlySummaryReports: unmarshalArrayOfObject(data.yearly_summary_reports, unmarshalDate)
|
|
56
|
+
};
|
|
85
57
|
};
|
|
86
58
|
const marshalUserApiDownloadImpactReportRequest = (request, defaults) => ({
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
59
|
+
date: request.date,
|
|
60
|
+
organization_id: request.organizationId ?? defaults.defaultOrganizationId,
|
|
61
|
+
type: request.type
|
|
90
62
|
});
|
|
91
|
-
export {
|
|
92
|
-
marshalUserApiDownloadImpactReportRequest,
|
|
93
|
-
unmarshalImpactDataResponse,
|
|
94
|
-
unmarshalImpactReportAvailability
|
|
95
|
-
};
|
|
63
|
+
export { marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse, unmarshalImpactReportAvailability };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/sdk-environmental-footprint",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Scaleway SDK environmental-footprint",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"files": [
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@scaleway/random-name": "5.1.2",
|
|
30
|
-
"@scaleway/sdk-std": "2.
|
|
30
|
+
"@scaleway/sdk-std": "2.2.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"@scaleway/sdk-client": "^2.1
|
|
33
|
+
"@scaleway/sdk-client": "^2.2.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@scaleway/sdk-client": "^2.1
|
|
36
|
+
"@scaleway/sdk-client": "^2.2.1"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"package:check": "pnpm publint",
|