emissions-api-sdk 1.0.4 → 1.0.6
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 +19 -26
- package/dist/Constants.js +6 -23
- package/dist/api/Calculation.js +0 -63
- package/dist/api/EconomicActivity.js +40 -0
- package/dist/api/Factor.js +0 -82
- package/dist/api/Fugitive.js +0 -63
- package/dist/api/Location.js +0 -61
- package/dist/api/Metadata.js +155 -0
- package/dist/api/Mobile.js +0 -64
- package/dist/api/RealEstate.js +40 -0
- package/dist/api/Stationary.js +0 -63
- package/dist/api/TransportationAndDistribution.js +0 -63
- package/dist/coverage/clover.xml +144 -199
- package/dist/coverage/coverage-final.json +14 -11
- package/dist/coverage/lcov-report/index.html +20 -20
- package/dist/coverage/lcov-report/src/Client.ts.html +28 -28
- package/dist/coverage/lcov-report/src/Constants.ts.html +31 -88
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +7 -217
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +220 -0
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +6 -285
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +7 -223
- package/dist/coverage/lcov-report/src/api/Location.ts.html +6 -222
- package/dist/coverage/lcov-report/src/api/Metadata.ts.html +604 -0
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +6 -231
- package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +217 -0
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +6 -225
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +7 -223
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +72 -27
- package/dist/coverage/lcov-report/src/index.html +7 -7
- package/dist/coverage/lcov-report/src/request.ts.html +5 -5
- package/dist/coverage/lcov-report/src/utils.ts.html +6 -6
- package/dist/coverage/lcov-report/test/index.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/index.html +1 -1
- package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
- package/dist/coverage/lcov.info +241 -294
- package/dist/index.js +4 -1
- package/dist/types/Constants.d.ts +5 -22
- package/dist/types/api/Calculation.d.ts +0 -41
- package/dist/types/api/EconomicActivity.d.ts +29 -0
- package/dist/types/api/Factor.d.ts +0 -52
- package/dist/types/api/Fugitive.d.ts +0 -41
- package/dist/types/api/Location.d.ts +0 -39
- package/dist/types/api/Metadata.d.ts +99 -0
- package/dist/types/api/Mobile.d.ts +0 -42
- package/dist/types/api/RealEstate.d.ts +29 -0
- package/dist/types/api/Stationary.d.ts +0 -41
- package/dist/types/api/TransportationAndDistribution.d.ts +0 -41
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interfaces/response/FactorResponse.d.ts +0 -4
- package/docs/_sources/index.rst.txt +8 -6
- package/docs/_sources/reference.rst.txt +17 -37
- package/docs/_static/basic.css +8 -0
- package/docs/_static/pygments.css +146 -164
- package/docs/_static/searchtools.js +5 -8
- package/docs/_static/styles/furo.css +1 -1
- package/docs/_static/styles/furo.css.map +1 -1
- package/docs/authentication.html +28 -19
- package/docs/client.html +28 -19
- package/docs/genindex.html +56 -71
- package/docs/getting_started.html +28 -19
- package/docs/index.html +31 -20
- package/docs/objects.inv +0 -0
- package/docs/reference.html +151 -357
- package/docs/sdk.html +28 -19
- package/docs/search.html +28 -19
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +28 -19
- package/package.json +7 -2
- package/sphinx-build/source/index.rst +8 -6
- package/sphinx-build/source/reference.rst +17 -37
- package/src/Constants.ts +6 -25
- package/src/api/Calculation.ts +1 -72
- package/src/api/EconomicActivity.ts +45 -0
- package/src/api/Factor.ts +1 -94
- package/src/api/Fugitive.ts +1 -74
- package/src/api/Location.ts +1 -73
- package/src/api/Metadata.ts +174 -0
- package/src/api/Mobile.ts +1 -76
- package/src/api/RealEstate.ts +45 -0
- package/src/api/Stationary.ts +1 -74
- package/src/api/TransportationAndDistribution.ts +1 -74
- package/src/index.ts +3 -0
- package/src/interfaces/response/FactorResponse.ts +0 -7
- package/test/apiTest.test.ts +19 -162
- package/test/metadata.test.ts +224 -0
- package/test/request.test.ts +0 -1
|
@@ -9,29 +9,12 @@ export declare const TRANSPORTATION_AND_DISTRIBUTION_API_PATH = "/v3/carbon/tran
|
|
|
9
9
|
export declare const FACTOR_API_PATH = "/v3/carbon/factor";
|
|
10
10
|
export declare const FACTOR_SET_API_PATH = "/v3/carbon/factorset";
|
|
11
11
|
export declare const SEARCH_API_PATH = "/v3/carbon/factor/search";
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const FUGITIVE_API_TYPES = "/v3/carbon/fugitive/types";
|
|
15
|
-
export declare const MOBILE_API_TYPES = "/v3/carbon/mobile/types";
|
|
16
|
-
export declare const STATIONARY_API_TYPES = "/v3/carbon/stationary/types";
|
|
17
|
-
export declare const FACTOR_API_TYPES = "/v3/carbon/factor/types";
|
|
18
|
-
export declare const TRANSPORTATION_AND_DISTRIBUTION_API_TYPES = "/v3/carbon/transportation-and-distribution/types";
|
|
19
|
-
export declare const FUGITIVE_API_AREA = "/v3/carbon/fugitive/area";
|
|
20
|
-
export declare const GENERAL_API_AREA = "/v3/carbon/calculation/area";
|
|
21
|
-
export declare const LOCATION_API_AREA = "/v3/carbon/location/area";
|
|
22
|
-
export declare const MOBILE_API_AREA = "/v3/carbon/mobile/area";
|
|
23
|
-
export declare const STATIONARY_API_AREA = "/v3/carbon/stationary/area";
|
|
24
|
-
export declare const TRANSPORTATION_AND_DISTRIBUTION_API_AREA = "/v3/carbon/transportation-and-distribution/area";
|
|
25
|
-
export declare const SEARCH_API_AREA = "/v3/carbon/factor/search/area";
|
|
26
|
-
export declare const FACTOR_API_AREA = "/v3/carbon/factor/area";
|
|
27
|
-
export declare const FUGITIVE_API_UNITS = "/v3/carbon/fugitive/units";
|
|
28
|
-
export declare const LOCATION_API_UNITS = "/v3/carbon/location/units";
|
|
29
|
-
export declare const MOBILE_API_UNITS = "/v3/carbon/mobile/units";
|
|
30
|
-
export declare const STATIONARY_API_UNITS = "/v3/carbon/stationary/units";
|
|
31
|
-
export declare const GENERAL_API_UNITS = "/v3/carbon/calculation/units";
|
|
32
|
-
export declare const FACTOR_API_UNITS = "/v3/carbon/factor/units";
|
|
33
|
-
export declare const TRANSPORTATION_AND_DISTRIBUTION_API_UNITS = "/v3/carbon/transportation-and-distribution/units";
|
|
12
|
+
export declare const ECONOMIC_ACTIVITY_API_PATH = "/v3/carbon/economic-activity";
|
|
13
|
+
export declare const REAL_ESTATE_API_PATH = "/v3/carbon/real-estate";
|
|
34
14
|
export declare const USAGE_API = "/v3/carbon/usage";
|
|
15
|
+
export declare const METADATA_TYPES_ENDPOINT = "/v3/carbon/metadata/types";
|
|
16
|
+
export declare const METADATA_AREA_ENDPOINT = "/v3/carbon/metadata/area";
|
|
17
|
+
export declare const METADATA_UNITS_ENDPOINT = "/v3/carbon/metadata/units";
|
|
35
18
|
export declare const GET = "GET";
|
|
36
19
|
export declare const POST = "POST";
|
|
37
20
|
export declare const CLIENT_SOURCE_HEADER = "X-Client-Source";
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { CalculationRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs emission calculations by making a POST request to the generic calculation API endpoint.
|
|
9
6
|
*
|
|
@@ -31,41 +28,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
31
28
|
* const result = await calculate(calculationRequest);
|
|
32
29
|
*/
|
|
33
30
|
export declare function calculate(payload: CalculationRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves available calculation types by making a GET request to the calculation types API endpoint.
|
|
36
|
-
*
|
|
37
|
-
* @export
|
|
38
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available calculation types
|
|
39
|
-
* @throws {Error} May throw an error if the API request fails
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* const types = await getTypes();
|
|
43
|
-
*/
|
|
44
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves information about geographical areas supported by the calculation API.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
50
|
-
* @throws {Error} May throw an error if the API request fails
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* const areas = await getArea();
|
|
54
|
-
*/
|
|
55
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
56
|
-
/**
|
|
57
|
-
* Retrieves available units for a specific calculation type.
|
|
58
|
-
*
|
|
59
|
-
* @export
|
|
60
|
-
* @param {string} type - The calculation type to get units for
|
|
61
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
62
|
-
* @throws {Error} May throw an error if the API request fails
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* // Get units for the "Natural Gas - Scope 3:AAA" emission calculation type with subtype
|
|
66
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
67
|
-
|
|
68
|
-
* // Get units for the "HFC-263fb" emission calculation type without subtype
|
|
69
|
-
* const units = await getUnits("HFC-263fb");
|
|
70
|
-
*/
|
|
71
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
3
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
4
|
+
/**
|
|
5
|
+
* Performs scope 3 Spend based emission calculations by making a POST request to the economic activity API endpoint.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {CommonRequest} payload - The request data to be sent to the API
|
|
9
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
10
|
+
* @throws {Error} May throw an error if the API request fails
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const request = {
|
|
14
|
+
"time": {
|
|
15
|
+
"date": "2025-01-04"
|
|
16
|
+
},
|
|
17
|
+
"location": {
|
|
18
|
+
"country": "usa"
|
|
19
|
+
},
|
|
20
|
+
"activity": {
|
|
21
|
+
"type": "accomodation",
|
|
22
|
+
"value": 1500.12,
|
|
23
|
+
"unit": "usd"
|
|
24
|
+
},
|
|
25
|
+
"includeDetails": false
|
|
26
|
+
};
|
|
27
|
+
* const result = await calculate(request);
|
|
28
|
+
*/
|
|
29
|
+
export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { FactorRequest, SearchRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { FactorResponse } from "../interfaces/response/FactorResponse";
|
|
4
3
|
import { SearchResponse } from "../interfaces/response/SearchResponse";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Retrieves a factor details by making a POST request to the factor API endpoint.
|
|
9
6
|
*
|
|
@@ -59,52 +56,3 @@ export declare function retrieveFactor(payload: FactorRequest): Promise<FactorRe
|
|
|
59
56
|
* const results = await search(searchRequest);
|
|
60
57
|
*/
|
|
61
58
|
export declare function search(payload: SearchRequest): Promise<SearchResponse>;
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves available emission factor types by making a GET request to the API endpoint.
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available emission factor types
|
|
67
|
-
* @throws {Error} May throw an error if the API request fails
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const types = await getTypes();
|
|
71
|
-
*/
|
|
72
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
73
|
-
/**
|
|
74
|
-
* Retrieves information about geographical areas supported by the factor search API.
|
|
75
|
-
*
|
|
76
|
-
* @export
|
|
77
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
78
|
-
* @throws {Error} May throw an error if the API request fails
|
|
79
|
-
*
|
|
80
|
-
* @example
|
|
81
|
-
* const areas = await getSearchArea();
|
|
82
|
-
*/
|
|
83
|
-
export declare function getSearchArea(): Promise<AreaResponse>;
|
|
84
|
-
/**
|
|
85
|
-
* Retrieves information about geographical areas supported by the factor API.
|
|
86
|
-
*
|
|
87
|
-
* @export
|
|
88
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
89
|
-
* @throws {Error} May throw an error if the API request fails
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* const areas = await getArea();
|
|
93
|
-
*/
|
|
94
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
95
|
-
/**
|
|
96
|
-
* Retrieves available units for a specific emission factor type.
|
|
97
|
-
*
|
|
98
|
-
* @export
|
|
99
|
-
* @param {string} type - The emission factor type to get units for (e.g., "Natural Gas - Scope 3:AAA")
|
|
100
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
101
|
-
* @throws {Error} May throw an error if the API request fails
|
|
102
|
-
*
|
|
103
|
-
* @example
|
|
104
|
-
* // Get units for the "Natural Gas - Scope 3:AAA" emission factor type with subtype
|
|
105
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
106
|
-
|
|
107
|
-
* // Get units for the "HFC-263fb" emission factor type without subtype
|
|
108
|
-
* const units = await getUnits("HFC-263fb");
|
|
109
|
-
*/
|
|
110
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs scope 1 fugitve emission calculations by making a POST request to the fugitive API endpoint.
|
|
9
6
|
*
|
|
@@ -30,41 +27,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
30
27
|
* const result = await calculate(request);
|
|
31
28
|
*/
|
|
32
29
|
export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves available fugitive emission calculation types by making a GET request to the API endpoint.
|
|
35
|
-
*
|
|
36
|
-
* @export
|
|
37
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available fugitive emission types
|
|
38
|
-
* @throws {Error} May throw an error if the API request fails
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* const types = await getTypes();
|
|
42
|
-
*/
|
|
43
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves information about geographical areas supported by the fugitive emissions API.
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
49
|
-
* @throws {Error} May throw an error if the API request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const areas = await getArea();
|
|
53
|
-
*/
|
|
54
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
55
|
-
/**
|
|
56
|
-
* Retrieves available units for a specific fugitive emission type.
|
|
57
|
-
*
|
|
58
|
-
* @export
|
|
59
|
-
* @param {string} type - The fugitive emission type to get units for (e.g., "R134A")
|
|
60
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
61
|
-
* @throws {Error} May throw an error if the API request fails
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* // Get units for the "Natural Gas - Scope 3:AAA" emission fugitive type with subtype
|
|
65
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
66
|
-
|
|
67
|
-
* // Get units for the "R-426A" emission fugitive type without subtype
|
|
68
|
-
* const units = await getUnits("R-426A");
|
|
69
|
-
*/
|
|
70
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { LocationRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs scope 2 purchased energy Emission calculations by making a POST request to the location API endpoint.
|
|
9
6
|
*
|
|
@@ -31,39 +28,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
31
28
|
* const result = await calculate(calculationRequest);
|
|
32
29
|
*/
|
|
33
30
|
export declare function calculate(payload: LocationRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves available location-based calculation types by making a GET request to the location types API endpoint.
|
|
36
|
-
*
|
|
37
|
-
* @export
|
|
38
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available location-based calculation types
|
|
39
|
-
* @throws {Error} May throw an error if the API request fails
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* const types = await getTypes();
|
|
44
|
-
*/
|
|
45
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves information about geographical areas supported by the location-based calculation API.
|
|
48
|
-
*
|
|
49
|
-
* @export
|
|
50
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
51
|
-
* @throws {Error} May throw an error if the API request fails
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* const areas = await getArea();
|
|
55
|
-
*/
|
|
56
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves available units for a specific location-based calculation type.
|
|
59
|
-
*
|
|
60
|
-
* @export
|
|
61
|
-
* @param {string} type - The location-based calculation type to get units for (e.g., "electricity")
|
|
62
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
63
|
-
* @throws {Error} May throw an error if the API request fails
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* // Get units for the "electricity" location type
|
|
67
|
-
* const units = await getUnits("electricity");
|
|
68
|
-
*/
|
|
69
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
2
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
3
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
4
|
+
/**
|
|
5
|
+
* Retrieves available emission source types for a specific endpoint using GET request.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {string} [endpoint] - The endpoint name to retrieve types for. Defaults to 'calculation' if not provided.
|
|
9
|
+
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available types
|
|
10
|
+
* @throws {Error} May throw an error if the API request fails
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Get types for calculation endpoint (default)
|
|
14
|
+
* const types = await getTypes();
|
|
15
|
+
*
|
|
16
|
+
* // Get types for a specific endpoint
|
|
17
|
+
* const locationTypes = await getTypes('location');
|
|
18
|
+
*/
|
|
19
|
+
export declare function getTypes(endpoint?: string): Promise<TypeResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves available emission source types for a specific endpoint using POST request.
|
|
22
|
+
*
|
|
23
|
+
* @export
|
|
24
|
+
* @param {string} [endpoint] - The endpoint name to retrieve types for. Defaults to 'calculation' if not provided.
|
|
25
|
+
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available types
|
|
26
|
+
* @throws {Error} May throw an error if the API request fails
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* // Get types for calculation endpoint (default)
|
|
30
|
+
* const types = await postTypes();
|
|
31
|
+
*
|
|
32
|
+
* // Get types for a specific endpoint
|
|
33
|
+
* const stationaryTypes = await postTypes('stationary');
|
|
34
|
+
*/
|
|
35
|
+
export declare function postTypes(endpoint?: string): Promise<TypeResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves available geographic locations for a specific endpoint using GET request.
|
|
38
|
+
*
|
|
39
|
+
* @export
|
|
40
|
+
* @param {string} [endpoint] - The endpoint name to retrieve locations for. Defaults to 'calculation' if not provided.
|
|
41
|
+
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the available locations
|
|
42
|
+
* @throws {Error} May throw an error if the API request fails
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Get areas for calculation endpoint (default)
|
|
46
|
+
* const areas = await getArea();
|
|
47
|
+
*
|
|
48
|
+
* // Get areas for a specific endpoint
|
|
49
|
+
* const mobileAreas = await getArea('mobile');
|
|
50
|
+
*/
|
|
51
|
+
export declare function getArea(endpoint?: string): Promise<AreaResponse>;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves available geographic locations for a specific endpoint using POST request.
|
|
54
|
+
*
|
|
55
|
+
* @export
|
|
56
|
+
* @param {string} [endpoint] - The endpoint name to retrieve locations for. Defaults to 'calculation' if not provided.
|
|
57
|
+
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the available locations
|
|
58
|
+
* @throws {Error} May throw an error if the API request fails
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Get areas for calculation endpoint (default)
|
|
62
|
+
* const areas = await postArea();
|
|
63
|
+
*
|
|
64
|
+
* // Get areas for a specific endpoint
|
|
65
|
+
* const fugitiveAreas = await postArea('fugitive');
|
|
66
|
+
*/
|
|
67
|
+
export declare function postArea(endpoint?: string): Promise<AreaResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Retrieves available measurement units for a specific type using GET request.
|
|
70
|
+
*
|
|
71
|
+
* @export
|
|
72
|
+
* @param {string} [type] - The emission source type to retrieve units for. If not provided, returns the full UOM table.
|
|
73
|
+
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
74
|
+
* @throws {Error} May throw an error if the API request fails
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Get all units
|
|
78
|
+
* const allUnits = await getUnits();
|
|
79
|
+
*
|
|
80
|
+
* // Get units for a specific type
|
|
81
|
+
* const naturalGasUnits = await getUnits('Natural Gas');
|
|
82
|
+
*/
|
|
83
|
+
export declare function getUnits(type?: string): Promise<UnitResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves available measurement units for a specific type using POST request.
|
|
86
|
+
*
|
|
87
|
+
* @export
|
|
88
|
+
* @param {string} [type] - The emission source type to retrieve units for. If not provided, returns the full UOM table.
|
|
89
|
+
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
90
|
+
* @throws {Error} May throw an error if the API request fails
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Get all units
|
|
94
|
+
* const allUnits = await postUnits();
|
|
95
|
+
*
|
|
96
|
+
* // Get units for a specific type
|
|
97
|
+
* const jetKeroseneUnits = await postUnits('Jet Kerosene');
|
|
98
|
+
*/
|
|
99
|
+
export declare function postUnits(type?: string): Promise<UnitResponse>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs Scope 1 mobile emissions related calculations by making a POST request to the mobile API endpoint.
|
|
9
6
|
*
|
|
@@ -31,42 +28,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
31
28
|
* const result = await calculate(request);
|
|
32
29
|
*/
|
|
33
30
|
export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves available mobile emission calculation types by making a GET request to the API endpoint.
|
|
36
|
-
*
|
|
37
|
-
* @export
|
|
38
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available mobile emission types
|
|
39
|
-
* @throws {Error} May throw an error if the API request fails
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* // Get all available mobile emission types
|
|
43
|
-
* const types = await getTypes();
|
|
44
|
-
*/
|
|
45
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
46
|
-
/**
|
|
47
|
-
* Retrieves information about geographical areas supported by the mobile emissions API.
|
|
48
|
-
*
|
|
49
|
-
* @export
|
|
50
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
51
|
-
* @throws {Error} May throw an error if the API request fails
|
|
52
|
-
*
|
|
53
|
-
* @example
|
|
54
|
-
* const areas = await getArea();
|
|
55
|
-
*/
|
|
56
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves available units for a specific mobile emission type.
|
|
59
|
-
*
|
|
60
|
-
* @export
|
|
61
|
-
* @param {string} type - The mobile emission type to get units for (e.g., "Diesel Fuel")
|
|
62
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
63
|
-
* @throws {Error} May throw an error if the API request fails
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* Get units for the "Cars:B20:(NE)" emission mobile type with subtype
|
|
67
|
-
* const units = await getUnits("Cars:B20:(NE)");
|
|
68
|
-
|
|
69
|
-
* Get units for the "Cars by Size - Large Car - Hybrid" emission mobile type without subtype
|
|
70
|
-
* const units = await getUnits("Cars by Size - Large Car - Hybrid");
|
|
71
|
-
*/
|
|
72
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
3
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
4
|
+
/**
|
|
5
|
+
* Performs scope 3 Real estate emission calculations by making a POST request to the real estate API endpoint.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @param {CommonRequest} payload - The request data to be sent to the API
|
|
9
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
10
|
+
* @throws {Error} May throw an error if the API request fails
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const request = {
|
|
14
|
+
"time": {
|
|
15
|
+
"date": "2025-01-04"
|
|
16
|
+
},
|
|
17
|
+
"location": {
|
|
18
|
+
"country": "usa"
|
|
19
|
+
},
|
|
20
|
+
"activity": {
|
|
21
|
+
"type": "Commercial Real Estate:Industrial distribution warehouse",
|
|
22
|
+
"value": 17000.123,
|
|
23
|
+
"unit": "m2"
|
|
24
|
+
},
|
|
25
|
+
"includeDetails": false
|
|
26
|
+
};
|
|
27
|
+
* const result = await calculate(request);
|
|
28
|
+
*/
|
|
29
|
+
export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs Scope 1 stationary calculations by making a POST request to the stationary API endpoint.
|
|
9
6
|
*
|
|
@@ -31,41 +28,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
31
28
|
* const result = await calculate(request);
|
|
32
29
|
*/
|
|
33
30
|
export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves available stationary emission calculation types by making a GET request to the API endpoint.
|
|
36
|
-
*
|
|
37
|
-
* @export
|
|
38
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available stationary emission types
|
|
39
|
-
* @throws {Error} May throw an error if the API request fails
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
* const types = await getTypes();
|
|
43
|
-
*/
|
|
44
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves information about geographical areas supported by the stationary emissions API.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
50
|
-
* @throws {Error} May throw an error if the API request fails
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* const areas = await getArea();
|
|
54
|
-
*/
|
|
55
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
56
|
-
/**
|
|
57
|
-
* Retrieves available units for a specific stationary emission type.
|
|
58
|
-
*
|
|
59
|
-
* @export
|
|
60
|
-
* @param {string} type - The stationary emission type to get units for (e.g., "Coal - Lignite")
|
|
61
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
62
|
-
* @throws {Error} May throw an error if the API request fails
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* Get units for the "Petroleum Based Greases - NC:A" emission stationary type with subtype
|
|
66
|
-
* const units = await getUnits("Petroleum Based Greases - NC:A");
|
|
67
|
-
|
|
68
|
-
* Get units for the "Jet Kerosene" emission stationary type without subtype
|
|
69
|
-
* const units = await getUnits("Jet Kerosene");
|
|
70
|
-
*/
|
|
71
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { CalculationRequest } from "../interfaces/Api";
|
|
2
|
-
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
2
|
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
3
|
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
-
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
-
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
7
4
|
/**
|
|
8
5
|
* Performs Scope 3 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
|
|
9
6
|
*
|
|
@@ -30,41 +27,3 @@ import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
|
30
27
|
* const result = await calculate(request);
|
|
31
28
|
*/
|
|
32
29
|
export declare function calculate(payload: CalculationRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
|
|
33
|
-
/**
|
|
34
|
-
* Retrieves available transportation and distribution calculation types by making a GET request to the API endpoint.
|
|
35
|
-
*
|
|
36
|
-
* @export
|
|
37
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available transportation and distribution calculation types
|
|
38
|
-
* @throws {Error} May throw an error if the API request fails
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* const types = await getTypes();
|
|
42
|
-
*/
|
|
43
|
-
export declare function getTypes(): Promise<TypeResponse>;
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves information about geographical areas supported by the transportation and distribution API.
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
49
|
-
* @throws {Error} May throw an error if the API request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const areas = await getArea();
|
|
53
|
-
*/
|
|
54
|
-
export declare function getArea(): Promise<AreaResponse>;
|
|
55
|
-
/**
|
|
56
|
-
* Retrieves available units for a specific transportation and distribution calculation type.
|
|
57
|
-
*
|
|
58
|
-
* @export
|
|
59
|
-
* @param {string} type - The transportation and distribution calculation type to get units for (e.g., "Freight - Cargo Ship")
|
|
60
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
61
|
-
* @throws {Error} May throw an error if the API request fails
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* // Get units for the "Business Travel - Cars:Diesel - Small" transportation and distribution type without subtype
|
|
65
|
-
* const units = await getUnits("Business Travel - Cars:Diesel - Small");
|
|
66
|
-
*
|
|
67
|
-
* // Get units for the "Business Travel - Cars" transportation and distribution type with subtype
|
|
68
|
-
* const units = await getUnits("Business Travel - Cars");
|
|
69
|
-
*/
|
|
70
|
-
export declare function getUnits(type: string): Promise<UnitResponse>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -8,6 +8,9 @@ export * as TransportationAndDistribution from './api/TransportationAndDistribut
|
|
|
8
8
|
export * as Usage from './api/Usage';
|
|
9
9
|
export * as Factor from './api/Factor';
|
|
10
10
|
export * as FactorSets from './api/FactorSets';
|
|
11
|
+
export * as EconomicActivity from './api/EconomicActivity';
|
|
12
|
+
export * as RealEstate from './api/RealEstate';
|
|
13
|
+
export * as Metadata from './api/Metadata';
|
|
11
14
|
export { ClientConfig } from './interfaces/Config';
|
|
12
15
|
export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
|
|
13
16
|
export { EmissionResponse } from './interfaces/response/EmissionResponse';
|
|
@@ -42,10 +42,6 @@ export interface FactorResponse {
|
|
|
42
42
|
publishedFrom?: string;
|
|
43
43
|
/** Publication end date in ISO format (optional) */
|
|
44
44
|
publishedTo?: string;
|
|
45
|
-
/** Effective start date in ISO format (optional) */
|
|
46
|
-
effectiveFrom?: string;
|
|
47
|
-
/** Effective end date in ISO format (optional) */
|
|
48
|
-
effectiveTo?: string;
|
|
49
45
|
/** Geographic region (e.g., "Earth", "India") */
|
|
50
46
|
region: string;
|
|
51
47
|
/** Unique factor identifier */
|
|
@@ -20,11 +20,13 @@ The **emissions-api-sdk** is a Node.js SDK for using Emissions API in your proje
|
|
|
20
20
|
Supported Emission Types
|
|
21
21
|
------------------------
|
|
22
22
|
|
|
23
|
-
* **Location** – emissions from region-specific factors
|
|
24
|
-
* **Fugitive** – emissions from leaks or fugitive sources
|
|
25
|
-
* **Mobile** – emissions from vehicles and mobile equipment
|
|
26
|
-
* **Stationary** – emissions from fixed fuel consumption
|
|
27
|
-
* **Transportation & distribution** – logistics and supply chain activities
|
|
28
|
-
* **
|
|
23
|
+
* **Location** – emissions from region-specific factors
|
|
24
|
+
* **Fugitive** – emissions from leaks or fugitive sources
|
|
25
|
+
* **Mobile** – emissions from vehicles and mobile equipment
|
|
26
|
+
* **Stationary** – emissions from fixed fuel consumption
|
|
27
|
+
* **Transportation & distribution** – logistics and supply chain activities
|
|
28
|
+
* **Real Estate** – emissions from commercial and residential properties
|
|
29
|
+
* **Economic Activity** – spend-based emissions from business activities
|
|
30
|
+
* **Generic** – custom emission calculations
|
|
29
31
|
|
|
30
32
|
The SDK is designed for embedding emission calculations in applications, building sustainability dashboards, automating large-scale datasets, and tracking carbon footprints.
|