emissions-api-sdk 1.0.0 → 1.0.2
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 +33 -2
- package/dist/Constants.js +23 -1
- package/dist/api/Calculation.js +78 -15
- package/dist/api/Factor.js +99 -18
- package/dist/api/FactorSets.js +1 -1
- package/dist/api/Fugitive.js +76 -13
- package/dist/api/Location.js +76 -15
- package/dist/api/Mobile.js +65 -1
- package/dist/api/Stationary.js +78 -15
- package/dist/api/TransportationAndDistribution.js +77 -14
- package/dist/coverage/clover.xml +191 -81
- package/dist/coverage/coverage-final.json +11 -11
- package/dist/coverage/lcov-report/index.html +16 -16
- package/dist/coverage/lcov-report/src/Client.ts.html +23 -23
- package/dist/coverage/lcov-report/src/Constants.ts.html +82 -4
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +245 -26
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +313 -34
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +8 -5
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +246 -24
- package/dist/coverage/lcov-report/src/api/Location.ts.html +245 -26
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +240 -12
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +248 -26
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +250 -25
- package/dist/coverage/lcov-report/src/api/index.html +25 -25
- package/dist/coverage/lcov-report/src/index.html +7 -7
- package/dist/coverage/lcov-report/src/request.ts.html +1 -1
- package/dist/coverage/lcov-report/src/utils.ts.html +5 -5
- 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 +287 -133
- package/dist/interfaces/response/AreaResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
- package/dist/interfaces/response/FactorResponse.js +2 -0
- package/dist/interfaces/response/FactorSetResponse.js +2 -0
- package/dist/interfaces/response/SearchResponse.js +2 -0
- package/dist/interfaces/response/TypeResponse.js +2 -0
- package/dist/interfaces/response/UnitResponse.js +2 -0
- package/dist/types/Constants.d.ts +22 -0
- package/dist/types/api/Calculation.d.ts +59 -16
- package/dist/types/api/Factor.d.ts +73 -20
- package/dist/types/api/FactorSets.d.ts +3 -2
- package/dist/types/api/Fugitive.d.ts +57 -14
- package/dist/types/api/Location.d.ts +57 -16
- package/dist/types/api/Mobile.d.ts +46 -2
- package/dist/types/api/Stationary.d.ts +59 -16
- package/dist/types/api/TransportationAndDistribution.d.ts +58 -15
- package/dist/types/index.d.ts +8 -0
- package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
- package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
- package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
- package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
- package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
- package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
- package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
- package/dist/types/interfaces/response/UnitResponse.d.ts +7 -0
- package/docs/.nojekyll +0 -0
- package/docs/_sources/authentication.rst.txt +164 -0
- package/docs/_sources/client.rst.txt +137 -0
- package/docs/_sources/getting_started.rst.txt +164 -0
- package/docs/_sources/index.rst.txt +30 -0
- package/docs/_sources/reference.rst.txt +129 -0
- package/docs/_sources/sdk.rst.txt +13 -0
- package/docs/_sources/troubleshooting.rst.txt +486 -0
- package/docs/_static/basic.css +914 -0
- package/docs/_static/custom.css +16 -0
- package/docs/_static/debug.css +69 -0
- package/docs/_static/doctools.js +149 -0
- package/docs/_static/documentation_options.js +13 -0
- package/docs/_static/file.png +0 -0
- package/docs/_static/language_data.js +192 -0
- package/docs/_static/minus.png +0 -0
- package/docs/_static/plus.png +0 -0
- package/docs/_static/pygments.css +232 -0
- package/docs/_static/scripts/furo-extensions.js +0 -0
- package/docs/_static/scripts/furo.js +3 -0
- package/docs/_static/scripts/furo.js.LICENSE.txt +7 -0
- package/docs/_static/scripts/furo.js.map +1 -0
- package/docs/_static/searchtools.js +632 -0
- package/docs/_static/skeleton.css +296 -0
- package/docs/_static/sphinx_highlight.js +154 -0
- package/docs/_static/sphinx_js.css +0 -0
- package/docs/_static/styles/furo-extensions.css +2 -0
- package/docs/_static/styles/furo-extensions.css.map +1 -0
- package/docs/_static/styles/furo.css +2 -0
- package/docs/_static/styles/furo.css.map +1 -0
- package/docs/authentication.html +523 -0
- package/docs/client.html +477 -0
- package/docs/genindex.html +492 -0
- package/docs/getting_started.html +491 -0
- package/docs/index.html +357 -0
- package/docs/objects.inv +0 -0
- package/docs/reference.html +1584 -0
- package/docs/sdk.html +334 -0
- package/docs/search.html +297 -0
- package/docs/searchindex.js +1 -0
- package/docs/troubleshooting.html +786 -0
- package/package.json +1 -1
- package/sphinx-build/Makefile +49 -0
- package/sphinx-build/requirements.txt +5 -0
- package/sphinx-build/source/_static/custom.css +16 -0
- package/sphinx-build/source/authentication.rst +164 -0
- package/sphinx-build/source/client.rst +137 -0
- package/sphinx-build/source/conf.py +56 -0
- package/sphinx-build/source/getting_started.rst +164 -0
- package/sphinx-build/source/index.rst +30 -0
- package/sphinx-build/source/reference.rst +129 -0
- package/sphinx-build/source/sdk.rst +13 -0
- package/sphinx-build/source/troubleshooting.rst +486 -0
- package/src/Constants.ts +26 -0
- package/src/api/Calculation.ts +94 -20
- package/src/api/Factor.ts +122 -28
- package/src/api/FactorSets.ts +4 -3
- package/src/api/Fugitive.ts +93 -18
- package/src/api/Location.ts +94 -20
- package/src/api/Mobile.ts +83 -6
- package/src/api/Stationary.ts +95 -20
- package/src/api/TransportationAndDistribution.ts +95 -19
- package/src/index.ts +33 -1
- package/src/interfaces/response/AreaResponse.ts +25 -0
- package/src/interfaces/response/EmissionResponse.ts +44 -0
- package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
- package/src/interfaces/response/FactorResponse.ts +78 -0
- package/src/interfaces/response/FactorSetResponse.ts +52 -0
- package/src/interfaces/response/SearchResponse.ts +52 -0
- package/src/interfaces/response/TypeResponse.ts +7 -0
- package/src/interfaces/response/UnitResponse.ts +7 -0
- package/test/apiTest.test.ts +173 -6
- package/dist/api/Factors.js +0 -98
- package/dist/api/FugitiveEmission.js +0 -40
- package/dist/api/GenericCalculation.js +0 -41
- package/dist/api/LocationEmission.js +0 -41
- package/dist/api/MobileEmission.js +0 -41
- package/dist/api/StationaryEmission.js +0 -41
- package/dist/api/TransportationDistributionEmission.js +0 -40
- package/dist/coverage/lcov-report/src/api/Factors.ts.html +0 -403
- package/dist/coverage/lcov-report/src/api/FugitiveEmission.ts.html +0 -214
- package/dist/coverage/lcov-report/src/api/GenericCalculation.ts.html +0 -217
- package/dist/coverage/lcov-report/src/api/LocationEmission.ts.html +0 -214
- package/dist/coverage/lcov-report/src/api/MobileEmission.ts.html +0 -220
- package/dist/coverage/lcov-report/src/api/StationaryEmission.ts.html +0 -220
- package/dist/coverage/lcov-report/src/api/TransportationDistributionEmission.ts.html +0 -211
- package/dist/types/api/Factors.d.ts +0 -68
- package/dist/types/api/FugitiveEmission.d.ts +0 -27
- package/dist/types/api/GenericCalculation.d.ts +0 -28
- package/dist/types/api/LocationEmission.d.ts +0 -28
- package/dist/types/api/MobileEmission.d.ts +0 -28
- package/dist/types/api/StationaryEmission.d.ts +0 -28
- package/dist/types/api/TransportationDistributionEmission.d.ts +0 -27
|
@@ -1,28 +1,71 @@
|
|
|
1
1
|
import { CalculationRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Performs emission calculations by making a POST request to the generic calculation API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {CalculationRequest} payload - The calculation request data to be sent to the API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const calculationRequest = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
"time" : {
|
|
18
|
+
"date": "2025-01-04"
|
|
19
|
+
},
|
|
20
|
+
"location": {
|
|
21
|
+
"country": "usa",
|
|
22
|
+
"stateProvince": "new york"
|
|
23
|
+
},
|
|
24
|
+
"activity": {
|
|
25
|
+
"type":"Waste Combusted - Steel Cans:Default factor",
|
|
26
|
+
"unit": "kg",
|
|
27
|
+
"value": 1223123.121
|
|
28
|
+
},
|
|
29
|
+
"includeDetails": true
|
|
30
|
+
};
|
|
26
31
|
* const result = await calculate(calculationRequest);
|
|
27
32
|
*/
|
|
28
|
-
export declare function calculate(payload: CalculationRequest): Promise<
|
|
33
|
+
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>;
|
|
@@ -1,44 +1,48 @@
|
|
|
1
1
|
import { FactorRequest, SearchRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { FactorResponse } from "../interfaces/response/FactorResponse";
|
|
4
|
+
import { SearchResponse } from "../interfaces/response/SearchResponse";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Retrieves a factor details by making a POST request to the factor API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {FactorRequest} payload - The factor request data to be sent to the API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<FactorResponse>} A promise that resolves to the FactorResponse returned by the API
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const factorRequest = {
|
|
12
|
-
|
|
13
17
|
"activity": {
|
|
14
|
-
|
|
18
|
+
"factorId": 12345
|
|
15
19
|
}
|
|
16
20
|
};
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
OR
|
|
19
23
|
|
|
20
24
|
const factorRequest = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
"time" : {
|
|
26
|
+
"date": "2025-01-04"
|
|
27
|
+
},
|
|
28
|
+
"location": {
|
|
29
|
+
"country": "usa",
|
|
30
|
+
"stateProvince": "new york"
|
|
31
|
+
},
|
|
32
|
+
"activity": {
|
|
33
|
+
"type":"natural gas"
|
|
34
|
+
},
|
|
35
|
+
"includeDetails": true
|
|
36
|
+
};
|
|
33
37
|
* const factor = await retrieveFactor(factorRequest);
|
|
34
38
|
*/
|
|
35
|
-
export declare function retrieveFactor(payload: FactorRequest): Promise<
|
|
39
|
+
export declare function retrieveFactor(payload: FactorRequest): Promise<FactorResponse>;
|
|
36
40
|
/**
|
|
37
41
|
* Performs a search operation by making a POST request to the search API endpoint.
|
|
38
42
|
*
|
|
39
43
|
* @export
|
|
40
44
|
* @param {SearchRequest} payload - The search request data to be sent to the API
|
|
41
|
-
* @return {Promise<
|
|
45
|
+
* @return {Promise<SearchResponse>} A promise that resolves to the search results returned by the API
|
|
42
46
|
* @throws {Error} May throw an error if the API request fails
|
|
43
47
|
*
|
|
44
48
|
* @example
|
|
@@ -48,10 +52,59 @@ export declare function retrieveFactor(payload: FactorRequest): Promise<string>;
|
|
|
48
52
|
},
|
|
49
53
|
"activity": {
|
|
50
54
|
"search" : "travel"},
|
|
51
|
-
|
|
55
|
+
"location": {
|
|
52
56
|
"country": "USA"
|
|
53
57
|
}
|
|
54
58
|
};
|
|
55
59
|
* const results = await search(searchRequest);
|
|
56
60
|
*/
|
|
57
|
-
export declare function search(payload: SearchRequest): Promise<
|
|
61
|
+
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,11 +1,12 @@
|
|
|
1
|
+
import { FactorSetResponse } from "../interfaces/response/FactorSetResponse";
|
|
1
2
|
/**
|
|
2
3
|
* Retrieves factor sets by making a GET request to the factor set API endpoint.
|
|
3
4
|
*
|
|
4
5
|
* @export
|
|
5
|
-
* @return {Promise<
|
|
6
|
+
* @return {Promise<FactorSetResponse>} A promise that resolves to the FactorSetResponse returned by the API
|
|
6
7
|
* @throws {Error} May throw an error if the API request fails
|
|
7
8
|
*
|
|
8
9
|
* @example
|
|
9
10
|
* const factorSets = await get();
|
|
10
11
|
*/
|
|
11
|
-
export declare function get(): Promise<
|
|
12
|
+
export declare function get(): Promise<FactorSetResponse>;
|
|
@@ -1,27 +1,70 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Performs scope 1 fugitve emission calculations by making a POST request to the fugitive API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {CommonRequest} payload - The request data to be sent to the API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const request = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
"time": {
|
|
18
|
+
"date": "2025-01-04"
|
|
19
|
+
},
|
|
20
|
+
"location": {
|
|
21
|
+
"country": "usa"
|
|
22
|
+
},
|
|
23
|
+
"activity": {
|
|
24
|
+
"type": "R134A",
|
|
25
|
+
"value": 150,
|
|
26
|
+
"unit": "kg"
|
|
27
|
+
},
|
|
28
|
+
"includeDetails": false
|
|
24
29
|
};
|
|
25
30
|
* const result = await calculate(request);
|
|
26
31
|
*/
|
|
27
|
-
export declare function calculate(payload: CommonRequest): Promise<
|
|
32
|
+
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,28 +1,69 @@
|
|
|
1
1
|
import { LocationRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Performs scope 2 purchased energy Emission calculations by making a POST request to the location API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {LocationRequest} payload - The location request data to be sent to the API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const calculationRequest = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
"time" : {
|
|
18
|
+
"date": "2025-01-04"
|
|
19
|
+
},
|
|
20
|
+
"location": {
|
|
21
|
+
"country": "usa",
|
|
22
|
+
"stateProvince": "new york"
|
|
23
|
+
},
|
|
24
|
+
"activity": {
|
|
25
|
+
"type":"electricity",
|
|
26
|
+
"unit": "kwh",
|
|
27
|
+
"value": 14123143
|
|
28
|
+
},
|
|
29
|
+
"includeDetails": true
|
|
30
|
+
};
|
|
26
31
|
* const result = await calculate(calculationRequest);
|
|
27
32
|
*/
|
|
28
|
-
export declare function calculate(payload: LocationRequest): Promise<
|
|
33
|
+
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>;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Performs Scope 1 mobile emissions related calculations by making a POST request to the mobile API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {CommonRequest} payload - The request data to be sent to the mobile API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
@@ -25,4 +30,43 @@ import { CommonRequest } from "../interfaces/Api";
|
|
|
25
30
|
};
|
|
26
31
|
* const result = await calculate(request);
|
|
27
32
|
*/
|
|
28
|
-
export declare function calculate(payload: CommonRequest): Promise<
|
|
33
|
+
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>;
|
|
@@ -1,28 +1,71 @@
|
|
|
1
1
|
import { CommonRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
8
|
* Performs Scope 1 stationary calculations by making a POST request to the stationary API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {CommonRequest} payload - The request data to be sent to the stationary API
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const request = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
"time" : {
|
|
18
|
+
"date": "2025-01-04"
|
|
19
|
+
},
|
|
20
|
+
"location": {
|
|
21
|
+
"country": "usa",
|
|
22
|
+
"stateProvince": "new york"
|
|
23
|
+
},
|
|
24
|
+
"activity": {
|
|
25
|
+
"type":"Coal - Lignite",
|
|
26
|
+
"unit": "KJ",
|
|
27
|
+
"value": 3
|
|
28
|
+
},
|
|
29
|
+
"includeDetails": true
|
|
30
|
+
};
|
|
26
31
|
* const result = await calculate(request);
|
|
27
32
|
*/
|
|
28
|
-
export declare function calculate(payload: CommonRequest): Promise<
|
|
33
|
+
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,27 +1,70 @@
|
|
|
1
1
|
import { CalculationRequest } from "../interfaces/Api";
|
|
2
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
3
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
4
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
5
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
6
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
2
7
|
/**
|
|
3
|
-
* Performs Scope
|
|
8
|
+
* Performs Scope 3 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
|
|
4
9
|
*
|
|
5
10
|
* @export
|
|
6
11
|
* @param {CalculationRequest} payload - The calculation request data for transportation and distribution operations
|
|
7
|
-
* @return {Promise<
|
|
12
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
8
13
|
* @throws {Error} May throw an error if the API request fails
|
|
9
14
|
*
|
|
10
15
|
* @example
|
|
11
16
|
* const request = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
"time" : {
|
|
18
|
+
"date": "2025-01-04"
|
|
19
|
+
},
|
|
20
|
+
"location": {
|
|
21
|
+
"country": "usa"
|
|
22
|
+
},
|
|
23
|
+
"activity": {
|
|
24
|
+
"type": "Freight - Cargo Ship - Bulk Carrier - 0-9999 dwt",
|
|
25
|
+
"unit": ["t","km"],
|
|
26
|
+
"value": [1.0,1.0]
|
|
27
|
+
},
|
|
28
|
+
"includeDetails": true
|
|
24
29
|
};
|
|
25
30
|
* const result = await calculate(request);
|
|
26
31
|
*/
|
|
27
|
-
export declare function calculate(payload: CalculationRequest): Promise<
|
|
32
|
+
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,3 +8,11 @@ export * as TransportationAndDistribution from './api/TransportationAndDistribut
|
|
|
8
8
|
export * as Factor from './api/Factor';
|
|
9
9
|
export * as FactorSets from './api/FactorSets';
|
|
10
10
|
export { ClientConfig } from './interfaces/Config';
|
|
11
|
+
export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
|
|
12
|
+
export { EmissionResponse } from './interfaces/response/EmissionResponse';
|
|
13
|
+
export { EmissionResponseWithDetails, UnitInfo, AreaInfo, AreaType, FactorDataTypeCategory, FactorSetInfo, FactorSelectionDefault, FactorDataTypeCode, FactorSetVersion, FactorValue, FactorMetaData, UnitConversion, EmissionData } from './interfaces/response/EmissionResponseWithDetails';
|
|
14
|
+
export { FactorResponse } from './interfaces/response/FactorResponse';
|
|
15
|
+
export { FactorSetResponse, FactorSet } from './interfaces/response/FactorSetResponse';
|
|
16
|
+
export { SearchResponse, Pagination, PaginationBody, SearchLink } from './interfaces/response/SearchResponse';
|
|
17
|
+
export { TypeResponse } from './interfaces/response/TypeResponse';
|
|
18
|
+
export { UnitResponse } from './interfaces/response/UnitResponse';
|