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
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
{
|
|
2
|
+
"exclude": {
|
|
3
|
+
"files": "^.secrets.baseline$",
|
|
4
|
+
"lines": null
|
|
5
|
+
},
|
|
6
|
+
"generated_at": "2026-03-05T05:02:32Z",
|
|
7
|
+
"plugins_used": [
|
|
8
|
+
{
|
|
9
|
+
"name": "AWSKeyDetector"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "ArtifactoryDetector"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"name": "AzureStorageKeyDetector"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"base64_limit": 4.5,
|
|
19
|
+
"name": "Base64HighEntropyString"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "BasicAuthDetector"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "BoxDetector"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "CloudantDetector"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"ghe_instance": "github.ibm.com",
|
|
32
|
+
"name": "GheDetector"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "GitHubTokenDetector"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"hex_limit": 3,
|
|
39
|
+
"name": "HexHighEntropyString"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "IbmCloudIamDetector"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "IbmCosHmacDetector"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "JwtTokenDetector"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"keyword_exclude": null,
|
|
52
|
+
"name": "KeywordDetector"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "MailchimpDetector"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "NpmDetector"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "PrivateKeyDetector"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "SlackDetector"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "SoftlayerDetector"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "SquareOAuthDetector"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "StripeDetector"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "TwilioKeyDetector"
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"results": {
|
|
80
|
+
"README.md": [
|
|
81
|
+
{
|
|
82
|
+
"hashed_secret": "9eddf3741c2ec20058940c3225b3e387cf6166dd",
|
|
83
|
+
"is_verified": false,
|
|
84
|
+
"line_number": 90,
|
|
85
|
+
"type": "Secret Keyword",
|
|
86
|
+
"verified_result": null
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"docs/_sources/authentication.rst.txt": [
|
|
90
|
+
{
|
|
91
|
+
"hashed_secret": "d92258e9826f7923e5fa45241420653a89db10b0",
|
|
92
|
+
"is_verified": false,
|
|
93
|
+
"line_number": 41,
|
|
94
|
+
"type": "Secret Keyword",
|
|
95
|
+
"verified_result": null
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"hashed_secret": "9eddf3741c2ec20058940c3225b3e387cf6166dd",
|
|
99
|
+
"is_verified": false,
|
|
100
|
+
"line_number": 152,
|
|
101
|
+
"type": "Secret Keyword",
|
|
102
|
+
"verified_result": null
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
"docs/_sources/client.rst.txt": [
|
|
106
|
+
{
|
|
107
|
+
"hashed_secret": "9eddf3741c2ec20058940c3225b3e387cf6166dd",
|
|
108
|
+
"is_verified": false,
|
|
109
|
+
"line_number": 108,
|
|
110
|
+
"type": "Secret Keyword",
|
|
111
|
+
"verified_result": null
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
"docs/_sources/getting_started.rst.txt": [
|
|
115
|
+
{
|
|
116
|
+
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
|
|
117
|
+
"is_verified": false,
|
|
118
|
+
"line_number": 122,
|
|
119
|
+
"type": "Secret Keyword",
|
|
120
|
+
"verified_result": null
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"docs/_sources/troubleshooting.rst.txt": [
|
|
124
|
+
{
|
|
125
|
+
"hashed_secret": "ade7ae7ec3dcbc8e6efab2ad366fd59b4be60bda",
|
|
126
|
+
"is_verified": false,
|
|
127
|
+
"line_number": 129,
|
|
128
|
+
"type": "Secret Keyword",
|
|
129
|
+
"verified_result": null
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"hashed_secret": "24de2a83c833555a5931a357cb9a639830db7851",
|
|
133
|
+
"is_verified": false,
|
|
134
|
+
"line_number": 191,
|
|
135
|
+
"type": "Secret Keyword",
|
|
136
|
+
"verified_result": null
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
|
|
140
|
+
"is_verified": false,
|
|
141
|
+
"line_number": 224,
|
|
142
|
+
"type": "Secret Keyword",
|
|
143
|
+
"verified_result": null
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
"docs/authentication.html": [
|
|
147
|
+
{
|
|
148
|
+
"hashed_secret": "7460410433c137c8124a7681126863dcc0172caa",
|
|
149
|
+
"is_verified": false,
|
|
150
|
+
"line_number": 287,
|
|
151
|
+
"type": "Secret Keyword",
|
|
152
|
+
"verified_result": null
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
"hashed_secret": "93f64017194ac1d984f80fc133f60bb9ec09215a",
|
|
156
|
+
"is_verified": false,
|
|
157
|
+
"line_number": 417,
|
|
158
|
+
"type": "Secret Keyword",
|
|
159
|
+
"verified_result": null
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"docs/getting_started.html": [
|
|
163
|
+
{
|
|
164
|
+
"hashed_secret": "93f64017194ac1d984f80fc133f60bb9ec09215a",
|
|
165
|
+
"is_verified": false,
|
|
166
|
+
"line_number": 289,
|
|
167
|
+
"type": "Secret Keyword",
|
|
168
|
+
"verified_result": null
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"docs/searchindex.js": [
|
|
172
|
+
{
|
|
173
|
+
"hashed_secret": "0c46900fa1fdf1610a99248b86d76554966d69c6",
|
|
174
|
+
"is_verified": false,
|
|
175
|
+
"line_number": 1,
|
|
176
|
+
"type": "Hex High Entropy String",
|
|
177
|
+
"verified_result": null
|
|
178
|
+
}
|
|
179
|
+
],
|
|
180
|
+
"sphinx-build/source/authentication.rst": [
|
|
181
|
+
{
|
|
182
|
+
"hashed_secret": "d92258e9826f7923e5fa45241420653a89db10b0",
|
|
183
|
+
"is_verified": false,
|
|
184
|
+
"line_number": 41,
|
|
185
|
+
"type": "Secret Keyword",
|
|
186
|
+
"verified_result": null
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"hashed_secret": "9eddf3741c2ec20058940c3225b3e387cf6166dd",
|
|
190
|
+
"is_verified": false,
|
|
191
|
+
"line_number": 152,
|
|
192
|
+
"type": "Secret Keyword",
|
|
193
|
+
"verified_result": null
|
|
194
|
+
}
|
|
195
|
+
],
|
|
196
|
+
"sphinx-build/source/client.rst": [
|
|
197
|
+
{
|
|
198
|
+
"hashed_secret": "9eddf3741c2ec20058940c3225b3e387cf6166dd",
|
|
199
|
+
"is_verified": false,
|
|
200
|
+
"line_number": 108,
|
|
201
|
+
"type": "Secret Keyword",
|
|
202
|
+
"verified_result": null
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
"sphinx-build/source/getting_started.rst": [
|
|
206
|
+
{
|
|
207
|
+
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
|
|
208
|
+
"is_verified": false,
|
|
209
|
+
"line_number": 122,
|
|
210
|
+
"type": "Secret Keyword",
|
|
211
|
+
"verified_result": null
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"sphinx-build/source/troubleshooting.rst": [
|
|
215
|
+
{
|
|
216
|
+
"hashed_secret": "ade7ae7ec3dcbc8e6efab2ad366fd59b4be60bda",
|
|
217
|
+
"is_verified": false,
|
|
218
|
+
"line_number": 129,
|
|
219
|
+
"type": "Secret Keyword",
|
|
220
|
+
"verified_result": null
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"hashed_secret": "24de2a83c833555a5931a357cb9a639830db7851",
|
|
224
|
+
"is_verified": false,
|
|
225
|
+
"line_number": 191,
|
|
226
|
+
"type": "Secret Keyword",
|
|
227
|
+
"verified_result": null
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
|
|
231
|
+
"is_verified": false,
|
|
232
|
+
"line_number": 224,
|
|
233
|
+
"type": "Secret Keyword",
|
|
234
|
+
"verified_result": null
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"src/Client.ts": [
|
|
238
|
+
{
|
|
239
|
+
"hashed_secret": "1f5e25be9b575e9f5d39c82dfd1d9f4d73f1975c",
|
|
240
|
+
"is_verified": false,
|
|
241
|
+
"line_number": 24,
|
|
242
|
+
"type": "Secret Keyword",
|
|
243
|
+
"verified_result": null
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"hashed_secret": "6303c901093123ff7019188dcd12b2e18d4d9827",
|
|
247
|
+
"is_verified": false,
|
|
248
|
+
"line_number": 28,
|
|
249
|
+
"type": "Secret Keyword",
|
|
250
|
+
"verified_result": null
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"hashed_secret": "f5cbae85fb47446511da4c9974e2da448caee7e1",
|
|
254
|
+
"is_verified": false,
|
|
255
|
+
"line_number": 31,
|
|
256
|
+
"type": "Secret Keyword",
|
|
257
|
+
"verified_result": null
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"hashed_secret": "65e622227634e8876cfa733000233fb80c6f0473",
|
|
261
|
+
"is_verified": false,
|
|
262
|
+
"line_number": 162,
|
|
263
|
+
"type": "Secret Keyword",
|
|
264
|
+
"verified_result": null
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"hashed_secret": "11fa7c37d697f30e6aee828b4426a10f83ab2380",
|
|
268
|
+
"is_verified": false,
|
|
269
|
+
"line_number": 230,
|
|
270
|
+
"type": "Secret Keyword",
|
|
271
|
+
"verified_result": null
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"hashed_secret": "68672f6baf3b3e9b3a80f7baa87e7a95a0ec2afb",
|
|
275
|
+
"is_verified": false,
|
|
276
|
+
"line_number": 240,
|
|
277
|
+
"type": "Secret Keyword",
|
|
278
|
+
"verified_result": null
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
"test/apiTest.test.ts": [
|
|
282
|
+
{
|
|
283
|
+
"hashed_secret": "c7139c95c9298c5ca457688f5c1d2e11ffbecc91",
|
|
284
|
+
"is_verified": false,
|
|
285
|
+
"line_number": 163,
|
|
286
|
+
"type": "Secret Keyword",
|
|
287
|
+
"verified_result": null
|
|
288
|
+
}
|
|
289
|
+
],
|
|
290
|
+
"test/client.test.ts": [
|
|
291
|
+
{
|
|
292
|
+
"hashed_secret": "2ace62c1befa19e3ea37dd52be9f6d508c5163e6",
|
|
293
|
+
"is_verified": false,
|
|
294
|
+
"line_number": 19,
|
|
295
|
+
"type": "Secret Keyword",
|
|
296
|
+
"verified_result": null
|
|
297
|
+
}
|
|
298
|
+
],
|
|
299
|
+
"test/metadata.test.ts": [
|
|
300
|
+
{
|
|
301
|
+
"hashed_secret": "c7139c95c9298c5ca457688f5c1d2e11ffbecc91",
|
|
302
|
+
"is_verified": false,
|
|
303
|
+
"line_number": 184,
|
|
304
|
+
"type": "Secret Keyword",
|
|
305
|
+
"verified_result": null
|
|
306
|
+
}
|
|
307
|
+
]
|
|
308
|
+
},
|
|
309
|
+
"version": "0.13.1+ibm.64.dss",
|
|
310
|
+
"word_list": {
|
|
311
|
+
"file": null,
|
|
312
|
+
"hash": null
|
|
313
|
+
}
|
|
314
|
+
}
|
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# IBM Envizi - Emissions API Node.js SDK
|
|
2
2
|
|
|
3
|
-
IBM Envizi - Emissions API (Emissions API) is a managed factor database and calculation engine for embedding greenhouse gas (GHG) emissions calculations into operational decision making.
|
|
3
|
+
[IBM Envizi - Emissions API](https://www.ibm.com/products/envizi/emissions-api) (Emissions API) is a managed factor database and calculation engine for embedding greenhouse gas (GHG) emissions calculations into operational decision making.
|
|
4
4
|
|
|
5
5
|
The `emissions-api-sdk` is a Node.js SDK for using Emissions API in your projects.
|
|
6
6
|
|
|
7
|
-
## Sign up
|
|
7
|
+
## Sign up
|
|
8
8
|
|
|
9
9
|
To get started with the Emissions API follow these steps:
|
|
10
10
|
|
|
11
|
-
- Sign up
|
|
11
|
+
- Sign up at the [IBMid sign up](https://www.ibm.com/account/reg/us-en/signup?formid=urx-54311) page.
|
|
12
12
|
- You will be sent an invite email to join to create an account.
|
|
13
13
|
- Read the [Introduction](https://developer.ibm.com/apis/catalog/ghgemissions--ibm-envizi-emissions-api/Introduction) page to get an overview of the Emissions API.
|
|
14
14
|
|
|
@@ -48,42 +48,35 @@ const result = await LocationEmission.calculate({
|
|
|
48
48
|
|
|
49
49
|
## Metadata APIs
|
|
50
50
|
|
|
51
|
-
The
|
|
52
|
-
|
|
53
|
-
### Get Available Types
|
|
51
|
+
The Metadata API provides a unified way to query metadata for any endpoint:
|
|
54
52
|
|
|
55
53
|
```javascript
|
|
56
|
-
import {
|
|
57
|
-
|
|
58
|
-
// Get all available Location emission types
|
|
59
|
-
const types = await LocationEmission.getTypes();
|
|
60
|
-
```
|
|
54
|
+
import { Metadata } from 'emissions-api-sdk';
|
|
61
55
|
|
|
62
|
-
|
|
56
|
+
// Get types for any endpoint (defaults to 'calculation')
|
|
57
|
+
const allTypes = await Metadata.getTypes();
|
|
58
|
+
const locationTypes = await Metadata.getTypes('location');
|
|
59
|
+
const stationaryTypes = await Metadata.postTypes('stationary');
|
|
63
60
|
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// Get areas for any endpoint
|
|
62
|
+
const allAreas = await Metadata.getArea();
|
|
63
|
+
const mobileAreas = await Metadata.getArea('mobile');
|
|
64
|
+
const fugitiveAreas = await Metadata.postArea('fugitive');
|
|
66
65
|
|
|
67
|
-
// Get
|
|
68
|
-
const
|
|
66
|
+
// Get units for any type
|
|
67
|
+
const allUnits = await Metadata.getUnits(); // All units
|
|
68
|
+
const typeUnits = await Metadata.getUnits('Natural Gas'); // Units for specific type
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```javascript
|
|
74
|
-
import { LocationEmission } from 'emissions-api-sdk';
|
|
75
|
-
|
|
76
|
-
// Get valid units for a specific emission type
|
|
77
|
-
const units = await LocationEmission.getUnits("electricity");
|
|
78
|
-
```
|
|
71
|
+
**Supported endpoints**: `calculation`, `location`, `stationary`, `mobile`, `fugitive`, `factor`, `search`, `transportation-and-distribution`, `economic-activity`, `real-estate`
|
|
79
72
|
|
|
80
73
|
### Get Organization Usage
|
|
81
74
|
```javascript
|
|
82
75
|
import { Usage } from 'emissions-api-sdk';
|
|
83
76
|
|
|
84
|
-
// Retrieves current billing period or historical usage data for the Organization
|
|
77
|
+
// Retrieves current billing period or historical usage data for the Organization
|
|
85
78
|
// History Flag to retrieve current billing or historical usage data.
|
|
86
|
-
const
|
|
79
|
+
const usage = await Usage.getUsage(true);
|
|
87
80
|
```
|
|
88
81
|
|
|
89
82
|
## Authentication
|
|
@@ -126,4 +119,4 @@ Other resources:
|
|
|
126
119
|
|
|
127
120
|
## License
|
|
128
121
|
|
|
129
|
-
This project is licensed under the terms of the [LICENSE](LICENSE) file.
|
|
122
|
+
This project is licensed under the terms of the [LICENSE](LICENSE) file.
|
package/dist/Constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLIENT_SOURCE_SDK = exports.CLIENT_SOURCE_EXCEL = exports.CLIENT_SOURCE_HEADER = exports.POST = exports.GET = exports.
|
|
3
|
+
exports.CLIENT_SOURCE_SDK = exports.CLIENT_SOURCE_EXCEL = exports.CLIENT_SOURCE_HEADER = exports.POST = exports.GET = exports.METADATA_UNITS_ENDPOINT = exports.METADATA_AREA_ENDPOINT = exports.METADATA_TYPES_ENDPOINT = exports.USAGE_API = exports.TYPE_RECOMMENDER_API_PATH = exports.REAL_ESTATE_API_PATH = exports.ECONOMIC_ACTIVITY_API_PATH = exports.SEARCH_API_PATH = exports.FACTOR_SET_API_PATH = exports.FACTOR_API_PATH = exports.TRANSPORTATION_AND_DISTRIBUTION_API_PATH = exports.GENERIC_CALCULATION_API_PATH = exports.STATIONARY_API_PATH = exports.FUGITIVE_API_PATH = exports.LOCATION_API_PATH = exports.MOBILE_API_PATH = exports.TOKEN_GENERATION_API = exports.API_DOMAIN = void 0;
|
|
4
4
|
exports.API_DOMAIN = "https://api.ibm.com/ghgemissions/run";
|
|
5
5
|
exports.TOKEN_GENERATION_API = "https://api.ibm.com/saascore/run/authentication-retrieve/api-key";
|
|
6
6
|
exports.MOBILE_API_PATH = "/v3/carbon/mobile";
|
|
@@ -14,35 +14,11 @@ exports.FACTOR_SET_API_PATH = "/v3/carbon/factorset";
|
|
|
14
14
|
exports.SEARCH_API_PATH = "/v3/carbon/factor/search";
|
|
15
15
|
exports.ECONOMIC_ACTIVITY_API_PATH = "/v3/carbon/economic-activity";
|
|
16
16
|
exports.REAL_ESTATE_API_PATH = "/v3/carbon/real-estate";
|
|
17
|
-
exports.
|
|
18
|
-
exports.LOCATION_TYPES = "/v3/carbon/location/types";
|
|
19
|
-
exports.FUGITIVE_API_TYPES = "/v3/carbon/fugitive/types";
|
|
20
|
-
exports.MOBILE_API_TYPES = "/v3/carbon/mobile/types";
|
|
21
|
-
exports.STATIONARY_API_TYPES = "/v3/carbon/stationary/types";
|
|
22
|
-
exports.FACTOR_API_TYPES = "/v3/carbon/factor/types";
|
|
23
|
-
exports.TRANSPORTATION_AND_DISTRIBUTION_API_TYPES = "/v3/carbon/transportation-and-distribution/types";
|
|
24
|
-
exports.REAL_ESTATE_API_TYPES = "/v3/carbon/real-estate/types";
|
|
25
|
-
exports.ECONOMIC_ACTIVITY_API_TYPES = "/v3/carbon/economic-activity/types";
|
|
26
|
-
exports.FUGITIVE_API_AREA = "/v3/carbon/fugitive/area";
|
|
27
|
-
exports.GENERAL_API_AREA = "/v3/carbon/calculation/area";
|
|
28
|
-
exports.LOCATION_API_AREA = "/v3/carbon/location/area";
|
|
29
|
-
exports.MOBILE_API_AREA = "/v3/carbon/mobile/area";
|
|
30
|
-
exports.STATIONARY_API_AREA = "/v3/carbon/stationary/area";
|
|
31
|
-
exports.TRANSPORTATION_AND_DISTRIBUTION_API_AREA = "/v3/carbon/transportation-and-distribution/area";
|
|
32
|
-
exports.SEARCH_API_AREA = "/v3/carbon/factor/search/area";
|
|
33
|
-
exports.FACTOR_API_AREA = "/v3/carbon/factor/area";
|
|
34
|
-
exports.REAL_ESTATE_API_AREA = "/v3/carbon/real-estate/area";
|
|
35
|
-
exports.ECONOMIC_ACTIVITY_API_AREA = "/v3/carbon/economic-activity/area";
|
|
36
|
-
exports.FUGITIVE_API_UNITS = "/v3/carbon/fugitive/units";
|
|
37
|
-
exports.LOCATION_API_UNITS = "/v3/carbon/location/units";
|
|
38
|
-
exports.MOBILE_API_UNITS = "/v3/carbon/mobile/units";
|
|
39
|
-
exports.STATIONARY_API_UNITS = "/v3/carbon/stationary/units";
|
|
40
|
-
exports.GENERAL_API_UNITS = "/v3/carbon/calculation/units";
|
|
41
|
-
exports.FACTOR_API_UNITS = "/v3/carbon/factor/units";
|
|
42
|
-
exports.TRANSPORTATION_AND_DISTRIBUTION_API_UNITS = "/v3/carbon/transportation-and-distribution/units";
|
|
43
|
-
exports.REAL_ESTATE_API_UNITS = "/v3/carbon/real-estate/units";
|
|
44
|
-
exports.ECONOMIC_ACTIVITY_API_UNITS = "/v3/carbon/economic-activity/units";
|
|
17
|
+
exports.TYPE_RECOMMENDER_API_PATH = "/v3/carbon/recommender/type/search";
|
|
45
18
|
exports.USAGE_API = "/v3/carbon/usage";
|
|
19
|
+
exports.METADATA_TYPES_ENDPOINT = "/v3/carbon/metadata/types";
|
|
20
|
+
exports.METADATA_AREA_ENDPOINT = "/v3/carbon/metadata/area";
|
|
21
|
+
exports.METADATA_UNITS_ENDPOINT = "/v3/carbon/metadata/units";
|
|
46
22
|
exports.GET = "GET";
|
|
47
23
|
exports.POST = "POST";
|
|
48
24
|
exports.CLIENT_SOURCE_HEADER = "X-Client-Source";
|
package/dist/api/Calculation.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 calculation types by making a GET request to the calculation types API endpoint.
|
|
47
|
-
*
|
|
48
|
-
* @export
|
|
49
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available calculation 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.CALCULATION_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 calculation 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.GENERAL_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 calculation type.
|
|
83
|
-
*
|
|
84
|
-
* @export
|
|
85
|
-
* @param {string} type - The calculation type to get units for
|
|
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 "Natural Gas - Scope 3:AAA" emission calculation type with subtype
|
|
91
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
92
|
-
|
|
93
|
-
* // Get units for the "HFC-263fb" emission calculation type without subtype
|
|
94
|
-
* const units = await getUnits("HFC-263fb");
|
|
95
|
-
*/
|
|
96
|
-
async function getUnits(type) {
|
|
97
|
-
const client = Client_1.Client.getInstance();
|
|
98
|
-
const url = client.getDomain() + Constants_1.GENERAL_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,60 +38,3 @@ async function calculate(payload) {
|
|
|
41
38
|
data: payload,
|
|
42
39
|
});
|
|
43
40
|
}
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves available economic activity 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 economic activity 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.ECONOMIC_ACTIVITY_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 economic activity 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.ECONOMIC_ACTIVITY_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 economic activity emission type.
|
|
82
|
-
*
|
|
83
|
-
* @export
|
|
84
|
-
* @param {string} type - The economic activity emission type to get units for (e.g., "accomodation")
|
|
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 "accomodation" emission economic activity type without subtype
|
|
90
|
-
* const units = await getUnits("accomodation");
|
|
91
|
-
*/
|
|
92
|
-
async function getUnits(type) {
|
|
93
|
-
const client = Client_1.Client.getInstance();
|
|
94
|
-
const url = client.getDomain() + Constants_1.ECONOMIC_ACTIVITY_API_UNITS;
|
|
95
|
-
return (0, request_1.makeApiRequest)({
|
|
96
|
-
method: Constants_1.GET,
|
|
97
|
-
url,
|
|
98
|
-
params: { type }
|
|
99
|
-
});
|
|
100
|
-
}
|
package/dist/api/Factor.js
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.retrieveFactor = retrieveFactor;
|
|
4
4
|
exports.search = search;
|
|
5
|
-
exports.getTypes = getTypes;
|
|
6
|
-
exports.getSearchArea = getSearchArea;
|
|
7
|
-
exports.getArea = getArea;
|
|
8
|
-
exports.getUnits = getUnits;
|
|
9
5
|
const Client_1 = require("../Client");
|
|
10
6
|
const Constants_1 = require("../Constants");
|
|
11
7
|
const request_1 = require("../request");
|
|
@@ -80,81 +76,3 @@ async function search(payload) {
|
|
|
80
76
|
data: payload,
|
|
81
77
|
});
|
|
82
78
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Retrieves available emission factor types by making a GET request to the API endpoint.
|
|
85
|
-
*
|
|
86
|
-
* @export
|
|
87
|
-
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available emission factor types
|
|
88
|
-
* @throws {Error} May throw an error if the API request fails
|
|
89
|
-
*
|
|
90
|
-
* @example
|
|
91
|
-
* const types = await getTypes();
|
|
92
|
-
*/
|
|
93
|
-
async function getTypes() {
|
|
94
|
-
const client = Client_1.Client.getInstance();
|
|
95
|
-
const url = client.getDomain() + Constants_1.FACTOR_API_TYPES;
|
|
96
|
-
return (0, request_1.makeApiRequest)({
|
|
97
|
-
method: Constants_1.GET,
|
|
98
|
-
url
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Retrieves information about geographical areas supported by the factor search API.
|
|
103
|
-
*
|
|
104
|
-
* @export
|
|
105
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
106
|
-
* @throws {Error} May throw an error if the API request fails
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* const areas = await getSearchArea();
|
|
110
|
-
*/
|
|
111
|
-
async function getSearchArea() {
|
|
112
|
-
const client = Client_1.Client.getInstance();
|
|
113
|
-
const url = client.getDomain() + Constants_1.SEARCH_API_AREA;
|
|
114
|
-
return (0, request_1.makeApiRequest)({
|
|
115
|
-
method: Constants_1.GET,
|
|
116
|
-
url
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Retrieves information about geographical areas supported by the factor API.
|
|
121
|
-
*
|
|
122
|
-
* @export
|
|
123
|
-
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
124
|
-
* @throws {Error} May throw an error if the API request fails
|
|
125
|
-
*
|
|
126
|
-
* @example
|
|
127
|
-
* const areas = await getArea();
|
|
128
|
-
*/
|
|
129
|
-
async function getArea() {
|
|
130
|
-
const client = Client_1.Client.getInstance();
|
|
131
|
-
const url = client.getDomain() + Constants_1.FACTOR_API_AREA;
|
|
132
|
-
return (0, request_1.makeApiRequest)({
|
|
133
|
-
method: Constants_1.GET,
|
|
134
|
-
url
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Retrieves available units for a specific emission factor type.
|
|
139
|
-
*
|
|
140
|
-
* @export
|
|
141
|
-
* @param {string} type - The emission factor type to get units for (e.g., "Natural Gas - Scope 3:AAA")
|
|
142
|
-
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
143
|
-
* @throws {Error} May throw an error if the API request fails
|
|
144
|
-
*
|
|
145
|
-
* @example
|
|
146
|
-
* // Get units for the "Natural Gas - Scope 3:AAA" emission factor type with subtype
|
|
147
|
-
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
148
|
-
|
|
149
|
-
* // Get units for the "HFC-263fb" emission factor type without subtype
|
|
150
|
-
* const units = await getUnits("HFC-263fb");
|
|
151
|
-
*/
|
|
152
|
-
async function getUnits(type) {
|
|
153
|
-
const client = Client_1.Client.getInstance();
|
|
154
|
-
const url = client.getDomain() + Constants_1.FACTOR_API_UNITS;
|
|
155
|
-
return (0, request_1.makeApiRequest)({
|
|
156
|
-
method: Constants_1.GET,
|
|
157
|
-
url,
|
|
158
|
-
params: { type }
|
|
159
|
-
});
|
|
160
|
-
}
|