emissions-api-sdk 1.0.12 → 1.0.14
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 +65 -2
- package/dist/Constants.js +7 -1
- package/dist/api/AuditExport.js +73 -0
- package/dist/api/AuditLog.js +99 -0
- package/dist/api/EconomicActivity.js +69 -0
- package/dist/api/Factor.js +16 -0
- package/dist/api/PhysicalActivity.js +87 -0
- package/dist/api/RealEstate.js +25 -1
- package/dist/api/TypeRecommender.js +19 -2
- package/dist/coverage/clover.xml +172 -89
- package/dist/coverage/coverage-final.json +15 -8
- package/dist/coverage/lcov-report/index.html +21 -21
- package/dist/coverage/lcov-report/src/Client.ts.html +32 -32
- package/dist/coverage/lcov-report/src/Constants.ts.html +45 -27
- package/dist/coverage/lcov-report/src/api/AuditExport.ts.html +355 -0
- package/dist/coverage/lcov-report/src/api/AuditLog.ts.html +388 -0
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +212 -5
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +54 -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/PhysicalActivity.ts.html +361 -0
- package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +78 -6
- 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 +55 -4
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +51 -6
- package/dist/coverage/lcov-report/src/index.html +7 -7
- package/dist/coverage/lcov-report/src/request.ts.html +8 -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/AttributionRequest.ts.html +151 -0
- package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/EconomicActivityAttributionRequest.ts.html +148 -0
- 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/PhysicalActivityEVICRequest.ts.html +148 -0
- package/dist/coverage/lcov-report/test/mocks/PhysicalActivityRequest.ts.html +151 -0
- package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/index.html +63 -3
- package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
- package/dist/coverage/lcov.info +284 -124
- package/dist/index.js +4 -1
- package/dist/interfaces/response/AuditExportResponse.js +2 -0
- package/dist/interfaces/response/AuditLogResponse.js +2 -0
- package/dist/request.js +1 -0
- package/dist/types/Constants.d.ts +6 -0
- package/dist/types/api/AuditExport.d.ts +42 -0
- package/dist/types/api/AuditLog.d.ts +37 -0
- package/dist/types/api/EconomicActivity.d.ts +69 -0
- package/dist/types/api/Factor.d.ts +16 -0
- package/dist/types/api/PhysicalActivity.d.ts +76 -0
- package/dist/types/api/RealEstate.d.ts +25 -1
- package/dist/types/api/TypeRecommender.d.ts +19 -2
- package/dist/types/index.d.ts +6 -0
- package/dist/types/interfaces/Api.d.ts +17 -1
- package/dist/types/interfaces/Config.d.ts +5 -1
- package/dist/types/interfaces/common.d.ts +40 -0
- package/dist/types/interfaces/response/AuditExportResponse.d.ts +66 -0
- package/dist/types/interfaces/response/AuditLogResponse.d.ts +40 -0
- package/dist/types/interfaces/response/TypeRecommenderResponse.d.ts +2 -0
- package/docs/_sources/authentication.rst.txt +26 -4
- package/docs/_sources/getting_started.rst.txt +762 -74
- package/docs/_sources/index.rst.txt +13 -0
- package/docs/_sources/reference.rst.txt +48 -0
- package/docs/_sources/troubleshooting.rst.txt +77 -12
- package/docs/_static/basic.css +8 -0
- package/docs/_static/doctools.js +5 -6
- package/docs/_static/language_data.js +186 -7
- package/docs/_static/pygments.css +146 -164
- package/docs/_static/searchtools.js +60 -121
- package/docs/_static/sphinx_highlight.js +31 -36
- package/docs/_static/styles/furo.css +1 -1
- package/docs/_static/styles/furo.css.map +1 -1
- package/docs/authentication.html +61 -26
- package/docs/client.html +33 -22
- package/docs/genindex.html +77 -24
- package/docs/getting_started.html +969 -103
- package/docs/index.html +69 -21
- package/docs/reference.html +747 -66
- package/docs/sdk.html +32 -21
- package/docs/search.html +32 -21
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +105 -38
- package/package.json +8 -3
- package/sphinx-build/source/authentication.rst +26 -4
- package/sphinx-build/source/getting_started.rst +762 -74
- package/sphinx-build/source/index.rst +13 -0
- package/sphinx-build/source/reference.rst +48 -0
- package/sphinx-build/source/troubleshooting.rst +77 -12
- package/src/Constants.ts +6 -0
- package/src/api/AuditExport.ts +90 -0
- package/src/api/AuditLog.ts +102 -0
- package/src/api/EconomicActivity.ts +69 -0
- package/src/api/Factor.ts +17 -1
- package/src/api/PhysicalActivity.ts +92 -0
- package/src/api/RealEstate.ts +25 -1
- package/src/api/TypeRecommender.ts +19 -2
- package/src/index.ts +15 -1
- package/src/interfaces/Api.ts +22 -6
- package/src/interfaces/Config.ts +6 -1
- package/src/interfaces/common.ts +46 -0
- package/src/interfaces/response/AuditExportResponse.ts +88 -0
- package/src/interfaces/response/AuditLogResponse.ts +47 -0
- package/src/interfaces/response/TypeRecommenderResponse.ts +3 -0
- package/src/request.ts +1 -0
- package/test/apiTest.test.ts +59 -3
- package/test/auditExport.test.ts +68 -0
- package/test/auditLog.test.ts +216 -0
- package/test/mocks/AttributionRequest.ts +23 -0
- package/test/mocks/EconomicActivityAttributionRequest.ts +22 -0
- package/test/mocks/PhysicalActivityEVICRequest.ts +22 -0
- package/test/mocks/PhysicalActivityRequest.ts +23 -0
- package/docs/_static/base-stemmer.js +0 -476
- package/docs/_static/english-stemmer.js +0 -1066
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html class="no-js" lang="en" data-content_root="./">
|
|
3
|
-
<head><meta charset="utf-8"
|
|
4
|
-
<meta name="viewport" content="width=device-width,initial-scale=1"
|
|
3
|
+
<head><meta charset="utf-8"/>
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
5
5
|
<meta name="color-scheme" content="light dark"><meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
-
<link rel="index" title="Index" href="genindex.html"
|
|
6
|
+
<link rel="index" title="Index" href="genindex.html" /><link rel="search" title="Search" href="search.html" /><link rel="prev" title="Reference" href="reference.html" />
|
|
7
7
|
|
|
8
|
-
<!-- Generated with Sphinx
|
|
8
|
+
<!-- Generated with Sphinx 8.1.3 and Furo 2025.07.19 -->
|
|
9
9
|
<title>Troubleshooting Guide - IBM Envizi - Emissions API Node.js SDK documentation</title>
|
|
10
10
|
<link rel="stylesheet" type="text/css" href="_static/pygments.css?v=d111a655" />
|
|
11
|
-
<link rel="stylesheet" type="text/css" href="_static/styles/furo.css?v=
|
|
11
|
+
<link rel="stylesheet" type="text/css" href="_static/styles/furo.css?v=25af2a20" />
|
|
12
12
|
<link rel="stylesheet" type="text/css" href="_static/sphinx_js.css" />
|
|
13
13
|
<link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?v=8dab3a3b" />
|
|
14
14
|
<link rel="stylesheet" type="text/css" href="_static/custom.css?v=8d04aa46" />
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
}
|
|
25
25
|
@media not print {
|
|
26
26
|
body[data-theme="dark"] {
|
|
27
|
-
--color-code-background: #
|
|
28
|
-
--color-code-foreground: #
|
|
27
|
+
--color-code-background: #2b2b2b;
|
|
28
|
+
--color-code-foreground: #f8f8f2;
|
|
29
29
|
|
|
30
30
|
}
|
|
31
31
|
@media (prefers-color-scheme: dark) {
|
|
32
32
|
body:not([data-theme="light"]) {
|
|
33
|
-
--color-code-background: #
|
|
34
|
-
--color-code-foreground: #
|
|
33
|
+
--color-code-background: #2b2b2b;
|
|
34
|
+
--color-code-foreground: #f8f8f2;
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -146,10 +146,14 @@
|
|
|
146
146
|
</symbol>
|
|
147
147
|
</svg>
|
|
148
148
|
|
|
149
|
-
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation"
|
|
150
|
-
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc"
|
|
151
|
-
<label class="overlay sidebar-overlay" for="__navigation"
|
|
152
|
-
<
|
|
149
|
+
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
|
|
150
|
+
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
|
|
151
|
+
<label class="overlay sidebar-overlay" for="__navigation">
|
|
152
|
+
<div class="visually-hidden">Hide navigation sidebar</div>
|
|
153
|
+
</label>
|
|
154
|
+
<label class="overlay toc-overlay" for="__toc">
|
|
155
|
+
<div class="visually-hidden">Hide table of contents sidebar</div>
|
|
156
|
+
</label>
|
|
153
157
|
|
|
154
158
|
<a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>
|
|
155
159
|
|
|
@@ -159,7 +163,8 @@
|
|
|
159
163
|
<header class="mobile-header">
|
|
160
164
|
<div class="header-left">
|
|
161
165
|
<label class="nav-overlay-icon" for="__navigation">
|
|
162
|
-
<
|
|
166
|
+
<div class="visually-hidden">Toggle site navigation sidebar</div>
|
|
167
|
+
<i class="icon"><svg><use href="#svg-menu"></use></svg></i>
|
|
163
168
|
</label>
|
|
164
169
|
</div>
|
|
165
170
|
<div class="header-center">
|
|
@@ -167,7 +172,8 @@
|
|
|
167
172
|
</div>
|
|
168
173
|
<div class="header-right">
|
|
169
174
|
<div class="theme-toggle-container theme-toggle-header">
|
|
170
|
-
<button class="theme-toggle"
|
|
175
|
+
<button class="theme-toggle">
|
|
176
|
+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
|
|
171
177
|
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
|
|
172
178
|
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
|
|
173
179
|
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
|
|
@@ -175,7 +181,8 @@
|
|
|
175
181
|
</button>
|
|
176
182
|
</div>
|
|
177
183
|
<label class="toc-overlay-icon toc-header-icon" for="__toc">
|
|
178
|
-
<
|
|
184
|
+
<div class="visually-hidden">Toggle table of contents sidebar</div>
|
|
185
|
+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
|
|
179
186
|
</label>
|
|
180
187
|
</div>
|
|
181
188
|
</header>
|
|
@@ -195,11 +202,13 @@
|
|
|
195
202
|
<p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
|
|
196
203
|
<ul class="current">
|
|
197
204
|
<li class="toctree-l1"><a class="reference internal" href="getting_started.html">Getting Started</a></li>
|
|
198
|
-
<li class="toctree-l1 has-children"><a class="reference internal" href="sdk.html">SDK</a><input
|
|
205
|
+
<li class="toctree-l1 has-children"><a class="reference internal" href="sdk.html">SDK</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of SDK</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
|
|
199
206
|
<li class="toctree-l2"><a class="reference internal" href="client.html">Client</a></li>
|
|
200
207
|
<li class="toctree-l2"><a class="reference internal" href="authentication.html">Authentication</a></li>
|
|
201
208
|
</ul>
|
|
202
209
|
</li>
|
|
210
|
+
<li class="toctree-l1"><a class="reference internal" href="authentication.html">Authentication</a></li>
|
|
211
|
+
<li class="toctree-l1"><a class="reference internal" href="client.html">Client</a></li>
|
|
203
212
|
<li class="toctree-l1"><a class="reference internal" href="reference.html">Reference</a></li>
|
|
204
213
|
<li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Troubleshooting Guide</a></li>
|
|
205
214
|
</ul>
|
|
@@ -228,7 +237,8 @@
|
|
|
228
237
|
</a>
|
|
229
238
|
</div>
|
|
230
239
|
<div class="theme-toggle-container theme-toggle-content">
|
|
231
|
-
<button class="theme-toggle"
|
|
240
|
+
<button class="theme-toggle">
|
|
241
|
+
<div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
|
|
232
242
|
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
|
|
233
243
|
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
|
|
234
244
|
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
|
|
@@ -236,7 +246,8 @@
|
|
|
236
246
|
</button>
|
|
237
247
|
</div>
|
|
238
248
|
<label class="toc-overlay-icon toc-content-icon" for="__toc">
|
|
239
|
-
<
|
|
249
|
+
<div class="visually-hidden">Toggle table of contents sidebar</div>
|
|
250
|
+
<i class="icon"><svg><use href="#svg-toc"></use></svg></i>
|
|
240
251
|
</label>
|
|
241
252
|
</div>
|
|
242
253
|
<article role="main" id="furo-main-content">
|
|
@@ -313,13 +324,48 @@
|
|
|
313
324
|
</pre></div>
|
|
314
325
|
</div>
|
|
315
326
|
</section>
|
|
327
|
+
<hr class="docutils" />
|
|
328
|
+
<section id="missing-client-id-with-pat-token">
|
|
329
|
+
<h4>4. Missing Client ID with PAT Token<a class="headerlink" href="#missing-client-id-with-pat-token" title="Link to this heading">¶</a></h4>
|
|
330
|
+
<p><strong>Error Message:</strong></p>
|
|
331
|
+
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>Error: If patToken is provided, "clientId" must also be provided.
|
|
332
|
+
</pre></div>
|
|
333
|
+
</div>
|
|
334
|
+
<p><strong>Cause:</strong> Personal Access Token (PAT) provided without client ID</p>
|
|
335
|
+
<p><strong>Solution:</strong> Provide <code class="docutils literal notranslate"><span class="pre">clientId</span></code> parameter when using a PAT token</p>
|
|
336
|
+
<p><strong>Sample Function Call That Causes This Error:</strong></p>
|
|
337
|
+
<div class="highlight-typescript notranslate"><div class="highlight"><pre><span></span><span class="k">await</span><span class="w"> </span><span class="nx">Client</span><span class="p">.</span><span class="nx">getClient</span><span class="p">({</span>
|
|
338
|
+
<span class="w"> </span><span class="nx">patToken</span><span class="o">:</span><span class="w"> </span><span class="s1">'your-pat-token'</span>
|
|
339
|
+
<span class="w"> </span><span class="c1">// Missing clientId parameter</span>
|
|
340
|
+
<span class="p">});</span>
|
|
341
|
+
</pre></div>
|
|
342
|
+
</div>
|
|
343
|
+
</section>
|
|
344
|
+
<hr class="docutils" />
|
|
345
|
+
<section id="organization-id-provided-with-pat-token">
|
|
346
|
+
<h4>5. Organization ID Provided with PAT Token<a class="headerlink" href="#organization-id-provided-with-pat-token" title="Link to this heading">¶</a></h4>
|
|
347
|
+
<p><strong>Error Message:</strong></p>
|
|
348
|
+
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>Error: orgId should not be provided when using patToken.
|
|
349
|
+
</pre></div>
|
|
350
|
+
</div>
|
|
351
|
+
<p><strong>Cause:</strong> Organization ID should not be used with Personal Access Token authentication</p>
|
|
352
|
+
<p><strong>Solution:</strong> Remove <code class="docutils literal notranslate"><span class="pre">orgId</span></code> parameter when using PAT token authentication</p>
|
|
353
|
+
<p><strong>Sample Function Call That Causes This Error:</strong></p>
|
|
354
|
+
<div class="highlight-typescript notranslate"><div class="highlight"><pre><span></span><span class="k">await</span><span class="w"> </span><span class="nx">Client</span><span class="p">.</span><span class="nx">getClient</span><span class="p">({</span>
|
|
355
|
+
<span class="w"> </span><span class="nx">patToken</span><span class="o">:</span><span class="w"> </span><span class="s1">'your-pat-token'</span><span class="p">,</span>
|
|
356
|
+
<span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s1">'client123'</span><span class="p">,</span>
|
|
357
|
+
<span class="w"> </span><span class="nx">orgId</span><span class="o">:</span><span class="w"> </span><span class="s1">'org456'</span><span class="w"> </span><span class="c1">// This should not be provided with PAT token</span>
|
|
358
|
+
<span class="p">});</span>
|
|
359
|
+
</pre></div>
|
|
360
|
+
</div>
|
|
361
|
+
</section>
|
|
316
362
|
</section>
|
|
317
363
|
<hr class="docutils" />
|
|
318
364
|
<section id="authentication-errors-http-401">
|
|
319
365
|
<h3>Authentication Errors (HTTP 401)<a class="headerlink" href="#authentication-errors-http-401" title="Link to this heading">¶</a></h3>
|
|
320
366
|
<p>These errors occur when authentication credentials are invalid or expired.</p>
|
|
321
367
|
<section id="invalid-api-key">
|
|
322
|
-
<h4>
|
|
368
|
+
<h4>6. Invalid API Key<a class="headerlink" href="#invalid-api-key" title="Link to this heading">¶</a></h4>
|
|
323
369
|
<p><strong>Error Response:</strong></p>
|
|
324
370
|
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
|
|
325
371
|
<span class="w"> </span><span class="nt">"httpCode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"401"</span><span class="p">,</span>
|
|
@@ -343,7 +389,7 @@
|
|
|
343
389
|
</section>
|
|
344
390
|
<hr class="docutils" />
|
|
345
391
|
<section id="invalid-organization-id">
|
|
346
|
-
<h4>
|
|
392
|
+
<h4>7. Invalid Organization ID<a class="headerlink" href="#invalid-organization-id" title="Link to this heading">¶</a></h4>
|
|
347
393
|
<p><strong>Error Response:</strong></p>
|
|
348
394
|
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
|
|
349
395
|
<span class="w"> </span><span class="nt">"httpCode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"401"</span><span class="p">,</span>
|
|
@@ -367,7 +413,7 @@
|
|
|
367
413
|
</section>
|
|
368
414
|
<hr class="docutils" />
|
|
369
415
|
<section id="invalid-client-id">
|
|
370
|
-
<h4>
|
|
416
|
+
<h4>8. Invalid Client ID<a class="headerlink" href="#invalid-client-id" title="Link to this heading">¶</a></h4>
|
|
371
417
|
<p><strong>Error Response:</strong></p>
|
|
372
418
|
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
|
|
373
419
|
<span class="w"> </span><span class="nt">"httpCode"</span><span class="p">:</span><span class="w"> </span><span class="s2">"401"</span><span class="p">,</span>
|
|
@@ -391,7 +437,7 @@
|
|
|
391
437
|
</section>
|
|
392
438
|
<hr class="docutils" />
|
|
393
439
|
<section id="empty-token-response">
|
|
394
|
-
<h4>
|
|
440
|
+
<h4>9. Empty Token Response<a class="headerlink" href="#empty-token-response" title="Link to this heading">¶</a></h4>
|
|
395
441
|
<p><strong>Error Message:</strong></p>
|
|
396
442
|
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>Error: Token response is empty
|
|
397
443
|
</pre></div>
|
|
@@ -420,7 +466,7 @@
|
|
|
420
466
|
</section>
|
|
421
467
|
<hr class="docutils" />
|
|
422
468
|
<section id="missing-expiry-field-in-token">
|
|
423
|
-
<h4>
|
|
469
|
+
<h4>10. Missing Expiry Field in Token<a class="headerlink" href="#missing-expiry-field-in-token" title="Link to this heading">¶</a></h4>
|
|
424
470
|
<p><strong>Error Message:</strong></p>
|
|
425
471
|
<div class="highlight-text notranslate"><div class="highlight"><pre><span></span>Error: exp field is missing in the token
|
|
426
472
|
</pre></div>
|
|
@@ -522,6 +568,16 @@
|
|
|
522
568
|
<td><p>N/A</p></td>
|
|
523
569
|
<td><p>Provide all three parameters</p></td>
|
|
524
570
|
</tr>
|
|
571
|
+
<tr class="row-odd"><td><p>Configuration</p></td>
|
|
572
|
+
<td><p><code class="docutils literal notranslate"><span class="pre">If</span> <span class="pre">patToken</span> <span class="pre">is</span> <span class="pre">provided,</span> <span class="pre">"clientId"</span> <span class="pre">must</span> <span class="pre">also</span> <span class="pre">be</span> <span class="pre">provided.</span></code></p></td>
|
|
573
|
+
<td><p>N/A</p></td>
|
|
574
|
+
<td><p>Provide clientId with PAT token</p></td>
|
|
575
|
+
</tr>
|
|
576
|
+
<tr class="row-even"><td><p>Configuration</p></td>
|
|
577
|
+
<td><p><code class="docutils literal notranslate"><span class="pre">orgId</span> <span class="pre">should</span> <span class="pre">not</span> <span class="pre">be</span> <span class="pre">provided</span> <span class="pre">when</span> <span class="pre">using</span> <span class="pre">patToken.</span></code></p></td>
|
|
578
|
+
<td><p>N/A</p></td>
|
|
579
|
+
<td><p>Remove orgId when using PAT token</p></td>
|
|
580
|
+
</tr>
|
|
525
581
|
<tr class="row-odd"><td><p>Authentication</p></td>
|
|
526
582
|
<td><p><code class="docutils literal notranslate"><span class="pre">Cannot</span> <span class="pre">pass</span> <span class="pre">the</span> <span class="pre">security</span> <span class="pre">checks...</span></code></p></td>
|
|
527
583
|
<td><p>401</p></td>
|
|
@@ -555,14 +611,22 @@
|
|
|
555
611
|
<section id="required-configuration-parameters">
|
|
556
612
|
<h2>Required Configuration Parameters<a class="headerlink" href="#required-configuration-parameters" title="Link to this heading">¶</a></h2>
|
|
557
613
|
<p>When calling <code class="docutils literal notranslate"><span class="pre">Client.getClient()</span></code>, the following parameters are required based on authentication method:</p>
|
|
558
|
-
<section id="
|
|
559
|
-
<h3>
|
|
614
|
+
<section id="personal-access-token-pat-authentication-recommended">
|
|
615
|
+
<h3>Personal Access Token (PAT) Authentication (Recommended)<a class="headerlink" href="#personal-access-token-pat-authentication-recommended" title="Link to this heading">¶</a></h3>
|
|
616
|
+
<ul class="simple">
|
|
617
|
+
<li><p><code class="docutils literal notranslate"><span class="pre">patToken</span></code> - Your Personal Access Token</p></li>
|
|
618
|
+
<li><p><code class="docutils literal notranslate"><span class="pre">clientId</span></code> - Your client ID</p></li>
|
|
619
|
+
</ul>
|
|
620
|
+
<p><strong>Note:</strong> Do not provide <code class="docutils literal notranslate"><span class="pre">orgId</span></code> when using PAT token authentication.</p>
|
|
621
|
+
</section>
|
|
622
|
+
<section id="api-key-authentication">
|
|
623
|
+
<h3>API Key Authentication<a class="headerlink" href="#api-key-authentication" title="Link to this heading">¶</a></h3>
|
|
560
624
|
<ul class="simple">
|
|
561
625
|
<li><p><code class="docutils literal notranslate"><span class="pre">apiKey</span></code> - Your IBM Cloud API key</p></li>
|
|
562
626
|
<li><p><code class="docutils literal notranslate"><span class="pre">clientId</span></code> - Your client ID</p></li>
|
|
563
627
|
<li><p><code class="docutils literal notranslate"><span class="pre">orgId</span></code> - Your organization ID</p></li>
|
|
564
|
-
<li><p><code class="docutils literal notranslate"><span class="pre">host</span></code> - API host URL</p></li>
|
|
565
|
-
<li><p><code class="docutils literal notranslate"><span class="pre">authUrl</span></code> - Authentication URL</p></li>
|
|
628
|
+
<li><p><code class="docutils literal notranslate"><span class="pre">host</span></code> - API host URL (optional, uses default if not provided)</p></li>
|
|
629
|
+
<li><p><code class="docutils literal notranslate"><span class="pre">authUrl</span></code> - Authentication URL (optional, uses default if not provided)</p></li>
|
|
566
630
|
</ul>
|
|
567
631
|
</section>
|
|
568
632
|
<section id="token-authentication">
|
|
@@ -662,8 +726,8 @@
|
|
|
662
726
|
</li>
|
|
663
727
|
</ol>
|
|
664
728
|
<hr class="docutils" />
|
|
665
|
-
<p><strong>Last Updated:</strong>
|
|
666
|
-
<p><strong>SDK Version:</strong> 1.0.
|
|
729
|
+
<p><strong>Last Updated:</strong> 2026-05-31</p>
|
|
730
|
+
<p><strong>SDK Version:</strong> 1.0.2</p>
|
|
667
731
|
<p><strong>Coverage:</strong> SDK initialization, client instance, and authentication errors</p>
|
|
668
732
|
</section>
|
|
669
733
|
</section>
|
|
@@ -722,14 +786,16 @@
|
|
|
722
786
|
<li><a class="reference internal" href="#missing-auth-url-with-custom-host">1. Missing Auth URL with Custom Host</a></li>
|
|
723
787
|
<li><a class="reference internal" href="#missing-client-id-with-token">2. Missing Client ID with Token</a></li>
|
|
724
788
|
<li><a class="reference internal" href="#missing-parameters-with-api-key">3. Missing Parameters with API Key</a></li>
|
|
789
|
+
<li><a class="reference internal" href="#missing-client-id-with-pat-token">4. Missing Client ID with PAT Token</a></li>
|
|
790
|
+
<li><a class="reference internal" href="#organization-id-provided-with-pat-token">5. Organization ID Provided with PAT Token</a></li>
|
|
725
791
|
</ul>
|
|
726
792
|
</li>
|
|
727
793
|
<li><a class="reference internal" href="#authentication-errors-http-401">Authentication Errors (HTTP 401)</a><ul>
|
|
728
|
-
<li><a class="reference internal" href="#invalid-api-key">
|
|
729
|
-
<li><a class="reference internal" href="#invalid-organization-id">
|
|
730
|
-
<li><a class="reference internal" href="#invalid-client-id">
|
|
731
|
-
<li><a class="reference internal" href="#empty-token-response">
|
|
732
|
-
<li><a class="reference internal" href="#missing-expiry-field-in-token">
|
|
794
|
+
<li><a class="reference internal" href="#invalid-api-key">6. Invalid API Key</a></li>
|
|
795
|
+
<li><a class="reference internal" href="#invalid-organization-id">7. Invalid Organization ID</a></li>
|
|
796
|
+
<li><a class="reference internal" href="#invalid-client-id">8. Invalid Client ID</a></li>
|
|
797
|
+
<li><a class="reference internal" href="#empty-token-response">9. Empty Token Response</a></li>
|
|
798
|
+
<li><a class="reference internal" href="#missing-expiry-field-in-token">10. Missing Expiry Field in Token</a></li>
|
|
733
799
|
</ul>
|
|
734
800
|
</li>
|
|
735
801
|
</ul>
|
|
@@ -744,7 +810,8 @@
|
|
|
744
810
|
</li>
|
|
745
811
|
<li><a class="reference internal" href="#error-summary-table">Error Summary Table</a></li>
|
|
746
812
|
<li><a class="reference internal" href="#required-configuration-parameters">Required Configuration Parameters</a><ul>
|
|
747
|
-
<li><a class="reference internal" href="#
|
|
813
|
+
<li><a class="reference internal" href="#personal-access-token-pat-authentication-recommended">Personal Access Token (PAT) Authentication (Recommended)</a></li>
|
|
814
|
+
<li><a class="reference internal" href="#api-key-authentication">API Key Authentication</a></li>
|
|
748
815
|
<li><a class="reference internal" href="#token-authentication">Token Authentication</a></li>
|
|
749
816
|
</ul>
|
|
750
817
|
</li>
|
|
@@ -770,8 +837,8 @@
|
|
|
770
837
|
</aside>
|
|
771
838
|
</div>
|
|
772
839
|
</div><script src="_static/documentation_options.js?v=5929fcd5"></script>
|
|
773
|
-
<script src="_static/doctools.js?v=
|
|
774
|
-
<script src="_static/sphinx_highlight.js?v=
|
|
840
|
+
<script src="_static/doctools.js?v=9bcbadda"></script>
|
|
841
|
+
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
|
|
775
842
|
<script src="_static/scripts/furo.js?v=46bd48cc"></script>
|
|
776
843
|
</body>
|
|
777
844
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emissions-api-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.14",
|
|
4
4
|
"description": "sdk for IBM Emissions APIs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -35,14 +35,19 @@
|
|
|
35
35
|
"author": "santhosh0703,Prakhar-sahu,taylorsteffanj",
|
|
36
36
|
"license": "Apache-2.0",
|
|
37
37
|
"resolutions": {
|
|
38
|
+
"@babel/core": "^7.29.6",
|
|
39
|
+
"brace-expansion": "^5.0.9",
|
|
40
|
+
"browserslist": "^4.28.7",
|
|
38
41
|
"follow-redirects": "^1.16.0",
|
|
42
|
+
"form-data": "^4.0.6",
|
|
39
43
|
"handlebars": "^4.7.9",
|
|
40
|
-
"
|
|
44
|
+
"js-yaml": "^4.3.1",
|
|
45
|
+
"markdown-it": "^14.3.0",
|
|
41
46
|
"minimatch": "^10.2.5",
|
|
42
47
|
"test-exclude": "^7.0.1"
|
|
43
48
|
},
|
|
44
49
|
"dependencies": {
|
|
45
|
-
"axios": "1.
|
|
50
|
+
"axios": "1.18.0"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
48
53
|
"@types/jest": "^30.0.0",
|
|
@@ -10,17 +10,39 @@ The IBM Envizi - Emissions API Node.js SDK uses OAuth 2.0 Bearer Tokens for auth
|
|
|
10
10
|
Authentication Methods
|
|
11
11
|
----------------------
|
|
12
12
|
|
|
13
|
-
The SDK provides
|
|
13
|
+
The SDK provides three authentication methods:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
Personal Access Token (PAT) Authentication (Recommended)
|
|
16
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
17
|
+
|
|
18
|
+
This method uses a personal access token directly:
|
|
19
|
+
|
|
20
|
+
.. code-block:: javascript
|
|
21
|
+
|
|
22
|
+
import { Client } from 'emissions-api-sdk';
|
|
23
|
+
|
|
24
|
+
await Client.getClient({
|
|
25
|
+
patToken: process.env.ENVIZI_PAT_TOKEN,
|
|
26
|
+
clientId: process.env.ENVIZI_CLIENT_ID
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
**Required parameters:**
|
|
30
|
+
- ``patToken``: Your personal access token
|
|
31
|
+
- ``clientId``: Your client identifier
|
|
32
|
+
|
|
33
|
+
.. note::
|
|
34
|
+
|
|
35
|
+
When using a PAT token, do not provide ``orgId``.
|
|
36
|
+
|
|
37
|
+
API Key Authentication
|
|
38
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
17
39
|
|
|
18
40
|
This method automatically handles token generation and refreshing:
|
|
19
41
|
|
|
20
42
|
.. code-block:: javascript
|
|
21
43
|
|
|
22
44
|
import { Client } from 'emissions-api-sdk';
|
|
23
|
-
|
|
45
|
+
|
|
24
46
|
await Client.getClient({
|
|
25
47
|
apiKey: process.env.ENVIZI_API_KEY,
|
|
26
48
|
clientId: process.env.ENVIZI_CLIENT_ID,
|