@scaleway/sdk-environmental-footprint 2.5.1 → 2.6.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/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
@@ -1,4 +1,2 @@
1
- import * as index_gen from "./v1alpha1/index.gen.js";
2
- export {
3
- index_gen as EnvironmentalFootprintv1alpha1
4
- };
1
+ import { index_gen_exports } from "./v1alpha1/index.gen.js";
2
+ export { index_gen_exports as EnvironmentalFootprintv1alpha1 };
@@ -1,74 +1,47 @@
1
+ import { marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse, unmarshalImpactReportAvailability } from "./marshalling.gen.js";
1
2
  import { API, urlParams } from "@scaleway/sdk-client";
2
- import { unmarshalImpactReportAvailability, marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse } from "./marshalling.gen.js";
3
- const jsonContentHeaders = {
4
- "Content-Type": "application/json; charset=utf-8"
5
- };
6
- class UserAPI extends API {
7
- /**
8
- * Get available impact reports. Returns a list of dates of available impact reports.
9
- *
10
- * @param request - The request {@link UserApiGetImpactReportAvailabilityRequest}
11
- * @returns A Promise of ImpactReportAvailability
12
- */
13
- getImpactReportAvailability = (request = {}) => this.client.fetch(
14
- {
15
- method: "GET",
16
- path: `/environmental-footprint/v1alpha1/reports/availability`,
17
- urlParams: urlParams(
18
- ["end_date", request.endDate],
19
- ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
20
- ["start_date", request.startDate]
21
- )
22
- },
23
- unmarshalImpactReportAvailability
24
- );
25
- /**
26
- * Download PDF impact report. Download a Scaleway impact PDF report with detailed impact data for your Scaleway projects.
27
- *
28
- * @param request - The request {@link UserApiDownloadImpactReportRequest}
29
- * @returns A Promise of Blob
30
- */
31
- downloadImpactReport = (request = {}) => this.client.fetch(
32
- {
33
- body: JSON.stringify(
34
- marshalUserApiDownloadImpactReportRequest(request, this.client.settings)
35
- ),
36
- headers: jsonContentHeaders,
37
- method: "POST",
38
- path: `/environmental-footprint/v1alpha1/reports/download`,
39
- urlParams: urlParams(
40
- ["dl", 1],
41
- ["date", request.date],
42
- ["organization_id", request.organizationId ?? this.client.settings.defaultOrganizationId],
43
- ["type", request.type]
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 { UserAPI } from "./api.gen.js";
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { marshalUserApiDownloadImpactReportRequest, unmarshalImpactDataResponse, unmarshalImpactReportAvailability } from "./marshalling.gen.js";
3
- export {
4
- UserAPI,
5
- marshalUserApiDownloadImpactReportRequest,
6
- unmarshalImpactDataResponse,
7
- unmarshalImpactReportAvailability
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, unmarshalDate, unmarshalArrayOfObject } from "@scaleway/sdk-client";
2
- const unmarshalImpact = (data) => {
3
- if (!isJSONObject(data)) {
4
- throw new TypeError(
5
- `Unmarshalling the type 'Impact' failed as data isn't a dictionary.`
6
- );
7
- }
8
- return {
9
- kgCo2Equivalent: data.kg_co2_equivalent,
10
- m3WaterUsage: data.m3_water_usage
11
- };
12
- };
13
- const unmarshalSkuImpact = (data) => {
14
- if (!isJSONObject(data)) {
15
- throw new TypeError(
16
- `Unmarshalling the type 'SkuImpact' failed as data isn't a dictionary.`
17
- );
18
- }
19
- return {
20
- productCategory: data.product_category,
21
- serviceCategory: data.service_category,
22
- sku: data.sku,
23
- totalSkuImpact: data.total_sku_impact ? unmarshalImpact(data.total_sku_impact) : void 0
24
- };
25
- };
26
- const unmarshalZoneImpact = (data) => {
27
- if (!isJSONObject(data)) {
28
- throw new TypeError(
29
- `Unmarshalling the type 'ZoneImpact' failed as data isn't a dictionary.`
30
- );
31
- }
32
- return {
33
- skus: unmarshalArrayOfObject(data.skus, unmarshalSkuImpact),
34
- totalZoneImpact: data.total_zone_impact ? unmarshalImpact(data.total_zone_impact) : void 0,
35
- zone: data.zone
36
- };
37
- };
38
- const unmarshalRegionImpact = (data) => {
39
- if (!isJSONObject(data)) {
40
- throw new TypeError(
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
- if (!isJSONObject(data)) {
64
- throw new TypeError(
65
- `Unmarshalling the type 'ImpactDataResponse' failed as data isn't a dictionary.`
66
- );
67
- }
68
- return {
69
- endDate: unmarshalDate(data.end_date),
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
- if (!isJSONObject(data)) {
77
- throw new TypeError(
78
- `Unmarshalling the type 'ImpactReportAvailability' failed as data isn't a dictionary.`
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
- date: request.date,
88
- organization_id: request.organizationId ?? defaults.defaultOrganizationId,
89
- type: request.type
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.5.1",
3
+ "version": "2.6.0",
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.1.1"
30
+ "@scaleway/sdk-std": "2.2.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@scaleway/sdk-client": "^2.1.0"
33
+ "@scaleway/sdk-client": "^2.2.0"
34
34
  },
35
35
  "devDependencies": {
36
- "@scaleway/sdk-client": "^2.1.0"
36
+ "@scaleway/sdk-client": "^2.2.0"
37
37
  },
38
38
  "scripts": {
39
39
  "package:check": "pnpm publint",