emissions-api-sdk 1.0.5 → 1.0.7
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/.secrets.baseline +314 -0
- package/README.md +20 -27
- package/dist/Constants.js +5 -29
- package/dist/api/Calculation.js +0 -63
- package/dist/api/EconomicActivity.js +0 -60
- 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 +0 -61
- package/dist/api/Stationary.js +0 -63
- package/dist/api/TransportationAndDistribution.js +0 -63
- package/dist/api/TypeRecommender.js +62 -0
- package/dist/coverage/clover.xml +142 -238
- package/dist/coverage/coverage-final.json +15 -13
- 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 -106
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +7 -217
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +7 -214
- 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 +6 -219
- 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/TypeRecommender.ts.html +277 -0
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +63 -33
- 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 +239 -353
- package/dist/index.js +3 -1
- package/dist/interfaces/response/TypeRecommenderResponse.js +2 -0
- package/dist/types/Constants.d.ts +4 -28
- package/dist/types/api/Calculation.d.ts +0 -41
- package/dist/types/api/EconomicActivity.d.ts +0 -38
- 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 +0 -39
- package/dist/types/api/Stationary.d.ts +0 -41
- package/dist/types/api/TransportationAndDistribution.d.ts +0 -41
- package/dist/types/api/TypeRecommender.d.ts +50 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/interfaces/response/TypeRecommenderResponse.d.ts +14 -0
- package/docs/_sources/reference.rst.txt +14 -50
- 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 +41 -84
- package/docs/getting_started.html +28 -19
- package/docs/index.html +29 -20
- package/docs/objects.inv +0 -0
- package/docs/reference.html +102 -502
- 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 +10 -7
- package/sphinx-build/requirements.txt +1 -0
- package/sphinx-build/source/reference.rst +14 -50
- package/src/Constants.ts +5 -30
- package/src/api/Calculation.ts +1 -72
- package/src/api/EconomicActivity.ts +1 -71
- 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 +1 -72
- package/src/api/Stationary.ts +1 -74
- package/src/api/TransportationAndDistribution.ts +1 -74
- package/src/api/TypeRecommender.ts +65 -0
- package/src/index.ts +4 -1
- package/src/interfaces/response/TypeRecommenderResponse.ts +18 -0
- package/test/apiTest.test.ts +9 -205
- package/test/metadata.test.ts +224 -0
- package/test/request.test.ts +0 -1
- package/sphinx-build/.secrets.baseline +0 -150
package/dist/api/Fugitive.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const Client_1 = require("../Client");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const request_1 = require("../request");
|
|
@@ -41,63 +38,3 @@ async function calculate(payload) {
|
|
|
41
38
|
data: payload,
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves available fugitive emission calculation types by making a GET request to the API endpoint.
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available fugitive emission types
|
|
49
|
-
* @throws {Error} May throw an error if the API request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const types = await getTypes();
|
|
53
|
-
*/
|
|
54
|
-
async function getTypes() {
|
|
55
|
-
const client = Client_1.Client.getInstance();
|
|
56
|
-
const url = client.getDomain() + Constants_1.FUGITIVE_API_TYPES;
|
|
57
|
-
return (0, request_1.makeApiRequest)({
|
|
58
|
-
method: Constants_1.GET,
|
|
59
|
-
url
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves information about geographical areas supported by the fugitive emissions API.
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
67
|
-
* @throws {Error} May throw an error if the API request fails
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const areas = await getArea();
|
|
71
|
-
*/
|
|
72
|
-
async function getArea() {
|
|
73
|
-
const client = Client_1.Client.getInstance();
|
|
74
|
-
const url = client.getDomain() + Constants_1.FUGITIVE_API_AREA;
|
|
75
|
-
return (0, request_1.makeApiRequest)({
|
|
76
|
-
method: Constants_1.GET,
|
|
77
|
-
url
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Retrieves available units for a specific fugitive emission type.
|
|
82
|
-
*
|
|
83
|
-
* @export
|
|
84
|
-
* @param {string} type - The fugitive emission type to get units for (e.g., "R134A")
|
|
85
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
86
|
-
* @throws {Error} May throw an error if the API request fails
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* // Get units for the "Natural Gas - Scope 3:AAA" emission fugitive type with subtype
|
|
90
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
91
|
-
|
|
92
|
-
* // Get units for the "R-426A" emission fugitive type without subtype
|
|
93
|
-
* const units = await getUnits("R-426A");
|
|
94
|
-
*/
|
|
95
|
-
async function getUnits(type) {
|
|
96
|
-
const client = Client_1.Client.getInstance();
|
|
97
|
-
const url = client.getDomain() + Constants_1.FUGITIVE_API_UNITS;
|
|
98
|
-
return (0, request_1.makeApiRequest)({
|
|
99
|
-
method: Constants_1.GET,
|
|
100
|
-
url,
|
|
101
|
-
params: { type }
|
|
102
|
-
});
|
|
103
|
-
}
|
package/dist/api/Location.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const Client_1 = require("../Client");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const request_1 = require("../request");
|
|
@@ -42,61 +39,3 @@ async function calculate(payload) {
|
|
|
42
39
|
data: payload,
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves available location-based calculation types by making a GET request to the location types API endpoint.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available location-based calculation types
|
|
50
|
-
* @throws {Error} May throw an error if the API request fails
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
*
|
|
54
|
-
* const types = await getTypes();
|
|
55
|
-
*/
|
|
56
|
-
async function getTypes() {
|
|
57
|
-
const client = Client_1.Client.getInstance();
|
|
58
|
-
const url = client.getDomain() + Constants_1.LOCATION_TYPES;
|
|
59
|
-
return (0, request_1.makeApiRequest)({
|
|
60
|
-
method: Constants_1.GET,
|
|
61
|
-
url
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Retrieves information about geographical areas supported by the location-based calculation API.
|
|
66
|
-
*
|
|
67
|
-
* @export
|
|
68
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
69
|
-
* @throws {Error} May throw an error if the API request fails
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* const areas = await getArea();
|
|
73
|
-
*/
|
|
74
|
-
async function getArea() {
|
|
75
|
-
const client = Client_1.Client.getInstance();
|
|
76
|
-
const url = client.getDomain() + Constants_1.LOCATION_API_AREA;
|
|
77
|
-
return (0, request_1.makeApiRequest)({
|
|
78
|
-
method: Constants_1.GET,
|
|
79
|
-
url
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves available units for a specific location-based calculation type.
|
|
84
|
-
*
|
|
85
|
-
* @export
|
|
86
|
-
* @param {string} type - The location-based calculation type to get units for (e.g., "electricity")
|
|
87
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
88
|
-
* @throws {Error} May throw an error if the API request fails
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* // Get units for the "electricity" location type
|
|
92
|
-
* const units = await getUnits("electricity");
|
|
93
|
-
*/
|
|
94
|
-
async function getUnits(type) {
|
|
95
|
-
const client = Client_1.Client.getInstance();
|
|
96
|
-
const url = client.getDomain() + Constants_1.LOCATION_API_UNITS;
|
|
97
|
-
return (0, request_1.makeApiRequest)({
|
|
98
|
-
method: Constants_1.GET,
|
|
99
|
-
url,
|
|
100
|
-
params: { type }
|
|
101
|
-
});
|
|
102
|
-
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTypes = getTypes;
|
|
4
|
+
exports.postTypes = postTypes;
|
|
5
|
+
exports.getArea = getArea;
|
|
6
|
+
exports.postArea = postArea;
|
|
7
|
+
exports.getUnits = getUnits;
|
|
8
|
+
exports.postUnits = postUnits;
|
|
9
|
+
const Client_1 = require("../Client");
|
|
10
|
+
const Constants_1 = require("../Constants");
|
|
11
|
+
const request_1 = require("../request");
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves available emission source types for a specific endpoint using GET request.
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @param {string} [endpoint] - The endpoint name to retrieve types for. Defaults to 'calculation' if not provided.
|
|
17
|
+
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available types
|
|
18
|
+
* @throws {Error} May throw an error if the API request fails
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* // Get types for calculation endpoint (default)
|
|
22
|
+
* const types = await getTypes();
|
|
23
|
+
*
|
|
24
|
+
* // Get types for a specific endpoint
|
|
25
|
+
* const locationTypes = await getTypes('location');
|
|
26
|
+
*/
|
|
27
|
+
async function getTypes(endpoint) {
|
|
28
|
+
const client = Client_1.Client.getInstance();
|
|
29
|
+
const url = client.getDomain() + Constants_1.METADATA_TYPES_ENDPOINT;
|
|
30
|
+
return (0, request_1.makeApiRequest)({
|
|
31
|
+
method: Constants_1.GET,
|
|
32
|
+
url,
|
|
33
|
+
params: endpoint ? { endpoint } : undefined,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Retrieves available emission source types for a specific endpoint using POST request.
|
|
38
|
+
*
|
|
39
|
+
* @export
|
|
40
|
+
* @param {string} [endpoint] - The endpoint name to retrieve types for. Defaults to 'calculation' if not provided.
|
|
41
|
+
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available types
|
|
42
|
+
* @throws {Error} May throw an error if the API request fails
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Get types for calculation endpoint (default)
|
|
46
|
+
* const types = await postTypes();
|
|
47
|
+
*
|
|
48
|
+
* // Get types for a specific endpoint
|
|
49
|
+
* const stationaryTypes = await postTypes('stationary');
|
|
50
|
+
*/
|
|
51
|
+
async function postTypes(endpoint) {
|
|
52
|
+
const client = Client_1.Client.getInstance();
|
|
53
|
+
const url = client.getDomain() + Constants_1.METADATA_TYPES_ENDPOINT;
|
|
54
|
+
return (0, request_1.makeApiRequest)({
|
|
55
|
+
method: Constants_1.POST,
|
|
56
|
+
url,
|
|
57
|
+
data: endpoint ? { endpoint } : {},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Retrieves available geographic locations for a specific endpoint using GET request.
|
|
62
|
+
*
|
|
63
|
+
* @export
|
|
64
|
+
* @param {string} [endpoint] - The endpoint name to retrieve locations for. Defaults to 'calculation' if not provided.
|
|
65
|
+
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the available locations
|
|
66
|
+
* @throws {Error} May throw an error if the API request fails
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Get areas for calculation endpoint (default)
|
|
70
|
+
* const areas = await getArea();
|
|
71
|
+
*
|
|
72
|
+
* // Get areas for a specific endpoint
|
|
73
|
+
* const mobileAreas = await getArea('mobile');
|
|
74
|
+
*/
|
|
75
|
+
async function getArea(endpoint) {
|
|
76
|
+
const client = Client_1.Client.getInstance();
|
|
77
|
+
const url = client.getDomain() + Constants_1.METADATA_AREA_ENDPOINT;
|
|
78
|
+
return (0, request_1.makeApiRequest)({
|
|
79
|
+
method: Constants_1.GET,
|
|
80
|
+
url,
|
|
81
|
+
params: endpoint ? { endpoint } : undefined,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Retrieves available geographic locations for a specific endpoint using POST request.
|
|
86
|
+
*
|
|
87
|
+
* @export
|
|
88
|
+
* @param {string} [endpoint] - The endpoint name to retrieve locations for. Defaults to 'calculation' if not provided.
|
|
89
|
+
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the available locations
|
|
90
|
+
* @throws {Error} May throw an error if the API request fails
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // Get areas for calculation endpoint (default)
|
|
94
|
+
* const areas = await postArea();
|
|
95
|
+
*
|
|
96
|
+
* // Get areas for a specific endpoint
|
|
97
|
+
* const fugitiveAreas = await postArea('fugitive');
|
|
98
|
+
*/
|
|
99
|
+
async function postArea(endpoint) {
|
|
100
|
+
const client = Client_1.Client.getInstance();
|
|
101
|
+
const url = client.getDomain() + Constants_1.METADATA_AREA_ENDPOINT;
|
|
102
|
+
return (0, request_1.makeApiRequest)({
|
|
103
|
+
method: Constants_1.POST,
|
|
104
|
+
url,
|
|
105
|
+
data: endpoint ? { endpoint } : {},
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Retrieves available measurement units for a specific type using GET request.
|
|
110
|
+
*
|
|
111
|
+
* @export
|
|
112
|
+
* @param {string} [type] - The emission source type to retrieve units for. If not provided, returns the full UOM table.
|
|
113
|
+
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
114
|
+
* @throws {Error} May throw an error if the API request fails
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* // Get all units
|
|
118
|
+
* const allUnits = await getUnits();
|
|
119
|
+
*
|
|
120
|
+
* // Get units for a specific type
|
|
121
|
+
* const naturalGasUnits = await getUnits('Natural Gas');
|
|
122
|
+
*/
|
|
123
|
+
async function getUnits(type) {
|
|
124
|
+
const client = Client_1.Client.getInstance();
|
|
125
|
+
const url = client.getDomain() + Constants_1.METADATA_UNITS_ENDPOINT;
|
|
126
|
+
return (0, request_1.makeApiRequest)({
|
|
127
|
+
method: Constants_1.GET,
|
|
128
|
+
url,
|
|
129
|
+
params: type ? { type } : undefined,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Retrieves available measurement units for a specific type using POST request.
|
|
134
|
+
*
|
|
135
|
+
* @export
|
|
136
|
+
* @param {string} [type] - The emission source type to retrieve units for. If not provided, returns the full UOM table.
|
|
137
|
+
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
138
|
+
* @throws {Error} May throw an error if the API request fails
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* // Get all units
|
|
142
|
+
* const allUnits = await postUnits();
|
|
143
|
+
*
|
|
144
|
+
* // Get units for a specific type
|
|
145
|
+
* const jetKeroseneUnits = await postUnits('Jet Kerosene');
|
|
146
|
+
*/
|
|
147
|
+
async function postUnits(type) {
|
|
148
|
+
const client = Client_1.Client.getInstance();
|
|
149
|
+
const url = client.getDomain() + Constants_1.METADATA_UNITS_ENDPOINT;
|
|
150
|
+
return (0, request_1.makeApiRequest)({
|
|
151
|
+
method: Constants_1.POST,
|
|
152
|
+
url,
|
|
153
|
+
data: type ? { type } : {},
|
|
154
|
+
});
|
|
155
|
+
}
|
package/dist/api/Mobile.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const request_1 = require("../request");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const Client_1 = require("../Client");
|
|
@@ -42,64 +39,3 @@ async function calculate(payload) {
|
|
|
42
39
|
data: payload,
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves available mobile emission calculation types by making a GET request to the API endpoint.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available mobile emission types
|
|
50
|
-
* @throws {Error} May throw an error if the API request fails
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* // Get all available mobile emission types
|
|
54
|
-
* const types = await getTypes();
|
|
55
|
-
*/
|
|
56
|
-
async function getTypes() {
|
|
57
|
-
const client = Client_1.Client.getInstance();
|
|
58
|
-
const url = client.getDomain() + Constants_1.MOBILE_API_TYPES;
|
|
59
|
-
return (0, request_1.makeApiRequest)({
|
|
60
|
-
method: Constants_1.GET,
|
|
61
|
-
url
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Retrieves information about geographical areas supported by the mobile emissions API.
|
|
66
|
-
*
|
|
67
|
-
* @export
|
|
68
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
69
|
-
* @throws {Error} May throw an error if the API request fails
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* const areas = await getArea();
|
|
73
|
-
*/
|
|
74
|
-
async function getArea() {
|
|
75
|
-
const client = Client_1.Client.getInstance();
|
|
76
|
-
const url = client.getDomain() + Constants_1.MOBILE_API_AREA;
|
|
77
|
-
return (0, request_1.makeApiRequest)({
|
|
78
|
-
method: Constants_1.GET,
|
|
79
|
-
url
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Retrieves available units for a specific mobile emission type.
|
|
84
|
-
*
|
|
85
|
-
* @export
|
|
86
|
-
* @param {string} type - The mobile emission type to get units for (e.g., "Diesel Fuel")
|
|
87
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
88
|
-
* @throws {Error} May throw an error if the API request fails
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* Get units for the "Cars:B20:(NE)" emission mobile type with subtype
|
|
92
|
-
* const units = await getUnits("Cars:B20:(NE)");
|
|
93
|
-
|
|
94
|
-
* Get units for the "Cars by Size - Large Car - Hybrid" emission mobile type without subtype
|
|
95
|
-
* const units = await getUnits("Cars by Size - Large Car - Hybrid");
|
|
96
|
-
*/
|
|
97
|
-
async function getUnits(type) {
|
|
98
|
-
const client = Client_1.Client.getInstance();
|
|
99
|
-
const url = client.getDomain() + Constants_1.MOBILE_API_UNITS;
|
|
100
|
-
return (0, request_1.makeApiRequest)({
|
|
101
|
-
method: Constants_1.GET,
|
|
102
|
-
url,
|
|
103
|
-
params: { type }
|
|
104
|
-
});
|
|
105
|
-
}
|
package/dist/api/RealEstate.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const Client_1 = require("../Client");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const request_1 = require("../request");
|
|
@@ -41,61 +38,3 @@ async function calculate(payload) {
|
|
|
41
38
|
data: payload,
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves available Real estate emission calculation types by making a GET request to the API endpoint.
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available Real estate emission types
|
|
49
|
-
* @throws {Error} May throw an error if the API request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const types = await getTypes();
|
|
53
|
-
*/
|
|
54
|
-
async function getTypes() {
|
|
55
|
-
const client = Client_1.Client.getInstance();
|
|
56
|
-
const url = client.getDomain() + Constants_1.REAL_ESTATE_API_TYPES;
|
|
57
|
-
return (0, request_1.makeApiRequest)({
|
|
58
|
-
method: Constants_1.GET,
|
|
59
|
-
url
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves information about geographical areas supported by the real estate emissions API.
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
67
|
-
* @throws {Error} May throw an error if the API request fails
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const areas = await getArea();
|
|
71
|
-
*/
|
|
72
|
-
async function getArea() {
|
|
73
|
-
const client = Client_1.Client.getInstance();
|
|
74
|
-
const url = client.getDomain() + Constants_1.REAL_ESTATE_API_AREA;
|
|
75
|
-
return (0, request_1.makeApiRequest)({
|
|
76
|
-
method: Constants_1.GET,
|
|
77
|
-
url
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Retrieves available units for a specific Real estate emission type.
|
|
82
|
-
*
|
|
83
|
-
* @export
|
|
84
|
-
* @param {string} type - The Real estate emission type to get units for (e.g., "R134A")
|
|
85
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
86
|
-
* @throws {Error} May throw an error if the API request fails
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* // Get units for the "Commercial Real Estate:Industrial distribution warehouse" emission real estate type with subtype
|
|
90
|
-
* const units = await getUnits("Commercial Real Estate:Industrial distribution warehouse");
|
|
91
|
-
|
|
92
|
-
*/
|
|
93
|
-
async function getUnits(type) {
|
|
94
|
-
const client = Client_1.Client.getInstance();
|
|
95
|
-
const url = client.getDomain() + Constants_1.REAL_ESTATE_API_UNITS;
|
|
96
|
-
return (0, request_1.makeApiRequest)({
|
|
97
|
-
method: Constants_1.GET,
|
|
98
|
-
url,
|
|
99
|
-
params: { type }
|
|
100
|
-
});
|
|
101
|
-
}
|
package/dist/api/Stationary.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const Client_1 = require("../Client");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const request_1 = require("../request");
|
|
@@ -42,63 +39,3 @@ async function calculate(payload) {
|
|
|
42
39
|
data: payload,
|
|
43
40
|
});
|
|
44
41
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Retrieves available stationary emission calculation types by making a GET request to the API endpoint.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available stationary emission types
|
|
50
|
-
* @throws {Error} May throw an error if the API request fails
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* const types = await getTypes();
|
|
54
|
-
*/
|
|
55
|
-
async function getTypes() {
|
|
56
|
-
const client = Client_1.Client.getInstance();
|
|
57
|
-
const url = client.getDomain() + Constants_1.STATIONARY_API_TYPES;
|
|
58
|
-
return (0, request_1.makeApiRequest)({
|
|
59
|
-
method: Constants_1.GET,
|
|
60
|
-
url
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves information about geographical areas supported by the stationary emissions API.
|
|
65
|
-
*
|
|
66
|
-
* @export
|
|
67
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
68
|
-
* @throws {Error} May throw an error if the API request fails
|
|
69
|
-
*
|
|
70
|
-
* @example
|
|
71
|
-
* const areas = await getArea();
|
|
72
|
-
*/
|
|
73
|
-
async function getArea() {
|
|
74
|
-
const client = Client_1.Client.getInstance();
|
|
75
|
-
const url = client.getDomain() + Constants_1.STATIONARY_API_AREA;
|
|
76
|
-
return (0, request_1.makeApiRequest)({
|
|
77
|
-
method: Constants_1.GET,
|
|
78
|
-
url
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Retrieves available units for a specific stationary emission type.
|
|
83
|
-
*
|
|
84
|
-
* @export
|
|
85
|
-
* @param {string} type - The stationary emission type to get units for (e.g., "Coal - Lignite")
|
|
86
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
87
|
-
* @throws {Error} May throw an error if the API request fails
|
|
88
|
-
*
|
|
89
|
-
* @example
|
|
90
|
-
* Get units for the "Petroleum Based Greases - NC:A" emission stationary type with subtype
|
|
91
|
-
* const units = await getUnits("Petroleum Based Greases - NC:A");
|
|
92
|
-
|
|
93
|
-
* Get units for the "Jet Kerosene" emission stationary type without subtype
|
|
94
|
-
* const units = await getUnits("Jet Kerosene");
|
|
95
|
-
*/
|
|
96
|
-
async function getUnits(type) {
|
|
97
|
-
const client = Client_1.Client.getInstance();
|
|
98
|
-
const url = client.getDomain() + Constants_1.STATIONARY_API_UNITS;
|
|
99
|
-
return (0, request_1.makeApiRequest)({
|
|
100
|
-
method: Constants_1.GET,
|
|
101
|
-
url,
|
|
102
|
-
params: { type }
|
|
103
|
-
});
|
|
104
|
-
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calculate = calculate;
|
|
4
|
-
exports.getTypes = getTypes;
|
|
5
|
-
exports.getArea = getArea;
|
|
6
|
-
exports.getUnits = getUnits;
|
|
7
4
|
const Client_1 = require("../Client");
|
|
8
5
|
const Constants_1 = require("../Constants");
|
|
9
6
|
const request_1 = require("../request");
|
|
@@ -41,63 +38,3 @@ async function calculate(payload) {
|
|
|
41
38
|
data: payload,
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves available transportation and distribution calculation types by making a GET request to the API endpoint.
|
|
46
|
-
*
|
|
47
|
-
* @export
|
|
48
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available transportation and distribution calculation types
|
|
49
|
-
* @throws {Error} May throw an error if the API request fails
|
|
50
|
-
*
|
|
51
|
-
* @example
|
|
52
|
-
* const types = await getTypes();
|
|
53
|
-
*/
|
|
54
|
-
async function getTypes() {
|
|
55
|
-
const client = Client_1.Client.getInstance();
|
|
56
|
-
const url = client.getDomain() + Constants_1.TRANSPORTATION_AND_DISTRIBUTION_API_TYPES;
|
|
57
|
-
return (0, request_1.makeApiRequest)({
|
|
58
|
-
method: Constants_1.GET,
|
|
59
|
-
url
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Retrieves information about geographical areas supported by the transportation and distribution API.
|
|
64
|
-
*
|
|
65
|
-
* @export
|
|
66
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
67
|
-
* @throws {Error} May throw an error if the API request fails
|
|
68
|
-
*
|
|
69
|
-
* @example
|
|
70
|
-
* const areas = await getArea();
|
|
71
|
-
*/
|
|
72
|
-
async function getArea() {
|
|
73
|
-
const client = Client_1.Client.getInstance();
|
|
74
|
-
const url = client.getDomain() + Constants_1.TRANSPORTATION_AND_DISTRIBUTION_API_AREA;
|
|
75
|
-
return (0, request_1.makeApiRequest)({
|
|
76
|
-
method: Constants_1.GET,
|
|
77
|
-
url
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Retrieves available units for a specific transportation and distribution calculation type.
|
|
82
|
-
*
|
|
83
|
-
* @export
|
|
84
|
-
* @param {string} type - The transportation and distribution calculation type to get units for (e.g., "Freight - Cargo Ship")
|
|
85
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
86
|
-
* @throws {Error} May throw an error if the API request fails
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* // Get units for the "Business Travel - Cars:Diesel - Small" transportation and distribution type without subtype
|
|
90
|
-
* const units = await getUnits("Business Travel - Cars:Diesel - Small");
|
|
91
|
-
*
|
|
92
|
-
* // Get units for the "Business Travel - Cars" transportation and distribution type with subtype
|
|
93
|
-
* const units = await getUnits("Business Travel - Cars");
|
|
94
|
-
*/
|
|
95
|
-
async function getUnits(type) {
|
|
96
|
-
const client = Client_1.Client.getInstance();
|
|
97
|
-
const url = client.getDomain() + Constants_1.TRANSPORTATION_AND_DISTRIBUTION_API_UNITS;
|
|
98
|
-
return (0, request_1.makeApiRequest)({
|
|
99
|
-
method: Constants_1.GET,
|
|
100
|
-
url,
|
|
101
|
-
params: { type }
|
|
102
|
-
});
|
|
103
|
-
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.search = search;
|
|
4
|
+
const Client_1 = require("../Client");
|
|
5
|
+
const Constants_1 = require("../Constants");
|
|
6
|
+
const request_1 = require("../request");
|
|
7
|
+
/**
|
|
8
|
+
* Search for activity types using semantic search with location, time, and license context. Supports pagination.
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @param {SearchRequest} payload - The search request data to be sent to the API
|
|
12
|
+
* @return {Promise<TypeResponse>} A promise that resolves to the activity types returned by the API
|
|
13
|
+
* @throws {Error} May throw an error if the API request fails
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const result = await search({
|
|
17
|
+
"location": {
|
|
18
|
+
"country": "usa"
|
|
19
|
+
},
|
|
20
|
+
"activity": {
|
|
21
|
+
"search": "electricity"
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
* @example
|
|
26
|
+
* const result = await search({
|
|
27
|
+
"location": {
|
|
28
|
+
"country": "usa",
|
|
29
|
+
"stateProvince": "california"
|
|
30
|
+
},
|
|
31
|
+
"time": {
|
|
32
|
+
"date": "2025-06-10"
|
|
33
|
+
},
|
|
34
|
+
"activity": {
|
|
35
|
+
"search": "electricity"
|
|
36
|
+
},
|
|
37
|
+
"pagination": {
|
|
38
|
+
"page": 1,
|
|
39
|
+
"size": 10
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
* @example
|
|
44
|
+
* const result = await search({
|
|
45
|
+
"location": {
|
|
46
|
+
"country": "usa",
|
|
47
|
+
"powerGrid": "WECC"
|
|
48
|
+
},
|
|
49
|
+
"activity": {
|
|
50
|
+
"search": "renewable energy"
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
*/
|
|
54
|
+
async function search(payload) {
|
|
55
|
+
const client = Client_1.Client.getInstance();
|
|
56
|
+
const url = client.getDomain() + Constants_1.TYPE_RECOMMENDER_API_PATH;
|
|
57
|
+
return (0, request_1.makeApiRequest)({
|
|
58
|
+
method: Constants_1.POST,
|
|
59
|
+
url,
|
|
60
|
+
data: payload,
|
|
61
|
+
});
|
|
62
|
+
}
|