emissions-api-sdk 1.0.11 → 1.0.12
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 +117 -0
- package/dist/api/Factor.js +53 -1
- package/dist/api/TypeRecommender.js +48 -0
- package/dist/coverage/clover.xml +17 -14
- package/dist/coverage/coverage-final.json +3 -3
- package/dist/coverage/lcov-report/index.html +7 -7
- package/dist/coverage/lcov-report/src/Client.ts.html +1 -1
- package/dist/coverage/lcov-report/src/Constants.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +159 -3
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Location.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Metadata.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TypeRecommender.ts.html +146 -2
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +1 -1
- package/dist/coverage/lcov-report/src/index.html +1 -1
- package/dist/coverage/lcov-report/src/request.ts.html +1 -1
- package/dist/coverage/lcov-report/src/utils.ts.html +1 -1
- 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 +148 -4
- package/dist/coverage/lcov-report/test/mocks/index.html +5 -5
- package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
- package/dist/coverage/lcov.info +16 -13
- package/dist/types/api/Factor.d.ts +53 -1
- package/dist/types/api/TypeRecommender.d.ts +48 -0
- package/dist/types/interfaces/common.d.ts +8 -0
- package/docs/_static/base-stemmer.js +476 -0
- package/docs/_static/basic.css +0 -8
- package/docs/_static/doctools.js +6 -5
- package/docs/_static/english-stemmer.js +1066 -0
- package/docs/_static/language_data.js +7 -186
- package/docs/_static/pygments.css +164 -146
- package/docs/_static/searchtools.js +121 -60
- package/docs/_static/sphinx_highlight.js +36 -31
- package/docs/_static/styles/furo.css +1 -1
- package/docs/_static/styles/furo.css.map +1 -1
- package/docs/authentication.html +21 -30
- package/docs/client.html +21 -30
- package/docs/genindex.html +21 -30
- package/docs/getting_started.html +21 -30
- package/docs/index.html +21 -30
- package/docs/reference.html +63 -72
- package/docs/sdk.html +21 -30
- package/docs/search.html +21 -30
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +21 -30
- package/package.json +1 -1
- package/src/api/Factor.ts +53 -1
- package/src/api/TypeRecommender.ts +48 -0
- package/src/interfaces/common.ts +12 -0
- package/test/mocks/SearchRequest.ts +48 -0
|
@@ -13,6 +13,7 @@ import { makeApiRequest } from "../request";
|
|
|
13
13
|
* @throws {Error} May throw an error if the API request fails
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
|
+
* // Basic search
|
|
16
17
|
* const result = await search({
|
|
17
18
|
"location": {
|
|
18
19
|
"country": "usa"
|
|
@@ -23,6 +24,7 @@ import { makeApiRequest } from "../request";
|
|
|
23
24
|
});
|
|
24
25
|
|
|
25
26
|
* @example
|
|
27
|
+
* // Search with time and pagination
|
|
26
28
|
* const result = await search({
|
|
27
29
|
"location": {
|
|
28
30
|
"country": "usa",
|
|
@@ -41,6 +43,7 @@ import { makeApiRequest } from "../request";
|
|
|
41
43
|
});
|
|
42
44
|
|
|
43
45
|
* @example
|
|
46
|
+
* // Search with power grid
|
|
44
47
|
* const result = await search({
|
|
45
48
|
"location": {
|
|
46
49
|
"country": "usa",
|
|
@@ -50,6 +53,51 @@ import { makeApiRequest } from "../request";
|
|
|
50
53
|
"search": "renewable energy"
|
|
51
54
|
}
|
|
52
55
|
});
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Search with optional unit parameter
|
|
59
|
+
* const result = await search({
|
|
60
|
+
"location": {
|
|
61
|
+
"country": "usa"
|
|
62
|
+
},
|
|
63
|
+
"activity": {
|
|
64
|
+
"search": "electricity",
|
|
65
|
+
"unit": "kWh"
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // Search with optional scope parameter
|
|
71
|
+
* const result = await search({
|
|
72
|
+
"location": {
|
|
73
|
+
"country": "usa"
|
|
74
|
+
},
|
|
75
|
+
"activity": {
|
|
76
|
+
"search": "natural gas",
|
|
77
|
+
"scope": "1"
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* // Search with both unit and scope parameters
|
|
83
|
+
* const result = await search({
|
|
84
|
+
"location": {
|
|
85
|
+
"country": "usa",
|
|
86
|
+
"stateProvince": "california"
|
|
87
|
+
},
|
|
88
|
+
"time": {
|
|
89
|
+
"date": "2025-06-10"
|
|
90
|
+
},
|
|
91
|
+
"activity": {
|
|
92
|
+
"search": "electricity",
|
|
93
|
+
"unit": "MWh",
|
|
94
|
+
"scope": "2"
|
|
95
|
+
},
|
|
96
|
+
"pagination": {
|
|
97
|
+
"page": 1,
|
|
98
|
+
"size": 10
|
|
99
|
+
}
|
|
100
|
+
});
|
|
53
101
|
*/
|
|
54
102
|
export async function search(
|
|
55
103
|
payload: SearchRequest
|
package/src/interfaces/common.ts
CHANGED
|
@@ -155,6 +155,18 @@ export interface SearchActivity {
|
|
|
155
155
|
* The search query string.
|
|
156
156
|
*/
|
|
157
157
|
search: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Optional unit (symbol) for search activity.
|
|
161
|
+
*/
|
|
162
|
+
unit?: string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Optional scope(1,2,3,3.1 to 3.15) for search activity.
|
|
166
|
+
*/
|
|
167
|
+
|
|
168
|
+
scope?: string;
|
|
169
|
+
|
|
158
170
|
}
|
|
159
171
|
|
|
160
172
|
/**
|
|
@@ -16,4 +16,52 @@ const SearchPayload: SearchRequest = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
// Search payload with unit parameter
|
|
20
|
+
export const SearchPayloadWithUnit: SearchRequest = {
|
|
21
|
+
location: {
|
|
22
|
+
"country": "usa"
|
|
23
|
+
},
|
|
24
|
+
time: {
|
|
25
|
+
date: "2025-06-10",
|
|
26
|
+
},
|
|
27
|
+
activity: {
|
|
28
|
+
"search": "electricity",
|
|
29
|
+
"unit": "kWh"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// Search payload with scope parameter
|
|
34
|
+
export const SearchPayloadWithScope: SearchRequest = {
|
|
35
|
+
location: {
|
|
36
|
+
"country": "usa"
|
|
37
|
+
},
|
|
38
|
+
time: {
|
|
39
|
+
date: "2025-06-10",
|
|
40
|
+
},
|
|
41
|
+
activity: {
|
|
42
|
+
"search": "natural gas",
|
|
43
|
+
"scope": "1"
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Search payload with both unit and scope parameters
|
|
48
|
+
export const SearchPayloadWithBoth: SearchRequest = {
|
|
49
|
+
location: {
|
|
50
|
+
"country": "usa",
|
|
51
|
+
"stateProvince": "california"
|
|
52
|
+
},
|
|
53
|
+
time: {
|
|
54
|
+
date: "2025-06-10",
|
|
55
|
+
},
|
|
56
|
+
activity: {
|
|
57
|
+
"search": "electricity",
|
|
58
|
+
"unit": "MWh",
|
|
59
|
+
"scope": "2"
|
|
60
|
+
},
|
|
61
|
+
pagination:{
|
|
62
|
+
"page": 1,
|
|
63
|
+
"size": 10
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
19
67
|
export default SearchPayload;
|