emissions-api-sdk 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +33 -2
  2. package/dist/Constants.js +23 -1
  3. package/dist/api/Calculation.js +78 -15
  4. package/dist/api/Factor.js +99 -18
  5. package/dist/api/FactorSets.js +1 -1
  6. package/dist/api/Fugitive.js +76 -13
  7. package/dist/api/Location.js +76 -15
  8. package/dist/api/Mobile.js +65 -1
  9. package/dist/api/Stationary.js +78 -15
  10. package/dist/api/TransportationAndDistribution.js +77 -14
  11. package/dist/coverage/clover.xml +191 -81
  12. package/dist/coverage/coverage-final.json +11 -11
  13. package/dist/coverage/lcov-report/index.html +16 -16
  14. package/dist/coverage/lcov-report/src/Client.ts.html +23 -23
  15. package/dist/coverage/lcov-report/src/Constants.ts.html +82 -4
  16. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +245 -26
  17. package/dist/coverage/lcov-report/src/api/Factor.ts.html +313 -34
  18. package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +8 -5
  19. package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +246 -24
  20. package/dist/coverage/lcov-report/src/api/Location.ts.html +245 -26
  21. package/dist/coverage/lcov-report/src/api/Mobile.ts.html +240 -12
  22. package/dist/coverage/lcov-report/src/api/Stationary.ts.html +248 -26
  23. package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +250 -25
  24. package/dist/coverage/lcov-report/src/api/index.html +25 -25
  25. package/dist/coverage/lcov-report/src/index.html +7 -7
  26. package/dist/coverage/lcov-report/src/request.ts.html +1 -1
  27. package/dist/coverage/lcov-report/src/utils.ts.html +5 -5
  28. package/dist/coverage/lcov-report/test/index.html +1 -1
  29. package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
  30. package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
  31. package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
  32. package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
  33. package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
  34. package/dist/coverage/lcov-report/test/mocks/index.html +1 -1
  35. package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
  36. package/dist/coverage/lcov.info +287 -133
  37. package/dist/interfaces/response/AreaResponse.js +2 -0
  38. package/dist/interfaces/response/EmissionResponse.js +2 -0
  39. package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
  40. package/dist/interfaces/response/FactorResponse.js +2 -0
  41. package/dist/interfaces/response/FactorSetResponse.js +2 -0
  42. package/dist/interfaces/response/SearchResponse.js +2 -0
  43. package/dist/interfaces/response/TypeResponse.js +2 -0
  44. package/dist/interfaces/response/UnitResponse.js +2 -0
  45. package/dist/types/Constants.d.ts +22 -0
  46. package/dist/types/api/Calculation.d.ts +59 -16
  47. package/dist/types/api/Factor.d.ts +73 -20
  48. package/dist/types/api/FactorSets.d.ts +3 -2
  49. package/dist/types/api/Fugitive.d.ts +57 -14
  50. package/dist/types/api/Location.d.ts +57 -16
  51. package/dist/types/api/Mobile.d.ts +46 -2
  52. package/dist/types/api/Stationary.d.ts +59 -16
  53. package/dist/types/api/TransportationAndDistribution.d.ts +58 -15
  54. package/dist/types/index.d.ts +8 -0
  55. package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
  56. package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
  57. package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
  58. package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
  59. package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
  60. package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
  61. package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
  62. package/dist/types/interfaces/response/UnitResponse.d.ts +7 -0
  63. package/docs/.nojekyll +0 -0
  64. package/docs/_sources/authentication.rst.txt +164 -0
  65. package/docs/_sources/client.rst.txt +137 -0
  66. package/docs/_sources/getting_started.rst.txt +164 -0
  67. package/docs/_sources/index.rst.txt +30 -0
  68. package/docs/_sources/reference.rst.txt +129 -0
  69. package/docs/_sources/sdk.rst.txt +13 -0
  70. package/docs/_sources/troubleshooting.rst.txt +486 -0
  71. package/docs/_static/basic.css +914 -0
  72. package/docs/_static/custom.css +16 -0
  73. package/docs/_static/debug.css +69 -0
  74. package/docs/_static/doctools.js +149 -0
  75. package/docs/_static/documentation_options.js +13 -0
  76. package/docs/_static/file.png +0 -0
  77. package/docs/_static/language_data.js +192 -0
  78. package/docs/_static/minus.png +0 -0
  79. package/docs/_static/plus.png +0 -0
  80. package/docs/_static/pygments.css +232 -0
  81. package/docs/_static/scripts/furo-extensions.js +0 -0
  82. package/docs/_static/scripts/furo.js +3 -0
  83. package/docs/_static/scripts/furo.js.LICENSE.txt +7 -0
  84. package/docs/_static/scripts/furo.js.map +1 -0
  85. package/docs/_static/searchtools.js +632 -0
  86. package/docs/_static/skeleton.css +296 -0
  87. package/docs/_static/sphinx_highlight.js +154 -0
  88. package/docs/_static/sphinx_js.css +0 -0
  89. package/docs/_static/styles/furo-extensions.css +2 -0
  90. package/docs/_static/styles/furo-extensions.css.map +1 -0
  91. package/docs/_static/styles/furo.css +2 -0
  92. package/docs/_static/styles/furo.css.map +1 -0
  93. package/docs/authentication.html +523 -0
  94. package/docs/client.html +477 -0
  95. package/docs/genindex.html +492 -0
  96. package/docs/getting_started.html +491 -0
  97. package/docs/index.html +357 -0
  98. package/docs/objects.inv +0 -0
  99. package/docs/reference.html +1584 -0
  100. package/docs/sdk.html +334 -0
  101. package/docs/search.html +297 -0
  102. package/docs/searchindex.js +1 -0
  103. package/docs/troubleshooting.html +786 -0
  104. package/package.json +1 -1
  105. package/sphinx-build/Makefile +49 -0
  106. package/sphinx-build/requirements.txt +5 -0
  107. package/sphinx-build/source/_static/custom.css +16 -0
  108. package/sphinx-build/source/authentication.rst +164 -0
  109. package/sphinx-build/source/client.rst +137 -0
  110. package/sphinx-build/source/conf.py +56 -0
  111. package/sphinx-build/source/getting_started.rst +164 -0
  112. package/sphinx-build/source/index.rst +30 -0
  113. package/sphinx-build/source/reference.rst +129 -0
  114. package/sphinx-build/source/sdk.rst +13 -0
  115. package/sphinx-build/source/troubleshooting.rst +486 -0
  116. package/src/Constants.ts +26 -0
  117. package/src/api/Calculation.ts +94 -20
  118. package/src/api/Factor.ts +122 -28
  119. package/src/api/FactorSets.ts +4 -3
  120. package/src/api/Fugitive.ts +93 -18
  121. package/src/api/Location.ts +94 -20
  122. package/src/api/Mobile.ts +83 -6
  123. package/src/api/Stationary.ts +95 -20
  124. package/src/api/TransportationAndDistribution.ts +95 -19
  125. package/src/index.ts +33 -1
  126. package/src/interfaces/response/AreaResponse.ts +25 -0
  127. package/src/interfaces/response/EmissionResponse.ts +44 -0
  128. package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
  129. package/src/interfaces/response/FactorResponse.ts +78 -0
  130. package/src/interfaces/response/FactorSetResponse.ts +52 -0
  131. package/src/interfaces/response/SearchResponse.ts +52 -0
  132. package/src/interfaces/response/TypeResponse.ts +7 -0
  133. package/src/interfaces/response/UnitResponse.ts +7 -0
  134. package/test/apiTest.test.ts +173 -6
  135. package/dist/api/Factors.js +0 -98
  136. package/dist/api/FugitiveEmission.js +0 -40
  137. package/dist/api/GenericCalculation.js +0 -41
  138. package/dist/api/LocationEmission.js +0 -41
  139. package/dist/api/MobileEmission.js +0 -41
  140. package/dist/api/StationaryEmission.js +0 -41
  141. package/dist/api/TransportationDistributionEmission.js +0 -40
  142. package/dist/coverage/lcov-report/src/api/Factors.ts.html +0 -403
  143. package/dist/coverage/lcov-report/src/api/FugitiveEmission.ts.html +0 -214
  144. package/dist/coverage/lcov-report/src/api/GenericCalculation.ts.html +0 -217
  145. package/dist/coverage/lcov-report/src/api/LocationEmission.ts.html +0 -214
  146. package/dist/coverage/lcov-report/src/api/MobileEmission.ts.html +0 -220
  147. package/dist/coverage/lcov-report/src/api/StationaryEmission.ts.html +0 -220
  148. package/dist/coverage/lcov-report/src/api/TransportationDistributionEmission.ts.html +0 -211
  149. package/dist/types/api/Factors.d.ts +0 -68
  150. package/dist/types/api/FugitiveEmission.d.ts +0 -27
  151. package/dist/types/api/GenericCalculation.d.ts +0 -28
  152. package/dist/types/api/LocationEmission.d.ts +0 -28
  153. package/dist/types/api/MobileEmission.d.ts +0 -28
  154. package/dist/types/api/StationaryEmission.d.ts +0 -28
  155. package/dist/types/api/TransportationDistributionEmission.d.ts +0 -27
@@ -0,0 +1,491 @@
1
+ <!doctype html>
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"/>
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" /><link rel="search" title="Search" href="search.html" /><link rel="next" title="SDK" href="sdk.html" /><link rel="prev" title="IBM Envizi - Emissions API Node.js SDK" href="index.html" />
7
+
8
+ <!-- Generated with Sphinx 8.1.3 and Furo 2025.07.19 -->
9
+ <title>Getting Started - IBM Envizi - Emissions API Node.js SDK documentation</title>
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=25af2a20" />
12
+ <link rel="stylesheet" type="text/css" href="_static/sphinx_js.css" />
13
+ <link rel="stylesheet" type="text/css" href="_static/styles/furo-extensions.css?v=8dab3a3b" />
14
+ <link rel="stylesheet" type="text/css" href="_static/custom.css?v=8d04aa46" />
15
+
16
+
17
+
18
+
19
+ <style>
20
+ body {
21
+ --color-code-background: #f2f2f2;
22
+ --color-code-foreground: #1e1e1e;
23
+
24
+ }
25
+ @media not print {
26
+ body[data-theme="dark"] {
27
+ --color-code-background: #2b2b2b;
28
+ --color-code-foreground: #f8f8f2;
29
+
30
+ }
31
+ @media (prefers-color-scheme: dark) {
32
+ body:not([data-theme="light"]) {
33
+ --color-code-background: #2b2b2b;
34
+ --color-code-foreground: #f8f8f2;
35
+
36
+ }
37
+ }
38
+ }
39
+ </style></head>
40
+ <body>
41
+
42
+ <script>
43
+ document.body.dataset.theme = localStorage.getItem("theme") || "auto";
44
+ </script>
45
+
46
+
47
+ <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
48
+ <symbol id="svg-toc" viewBox="0 0 24 24">
49
+ <title>Contents</title>
50
+ <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
51
+ <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
52
+ </svg>
53
+ </symbol>
54
+ <symbol id="svg-menu" viewBox="0 0 24 24">
55
+ <title>Menu</title>
56
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
57
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
58
+ <line x1="3" y1="12" x2="21" y2="12"></line>
59
+ <line x1="3" y1="6" x2="21" y2="6"></line>
60
+ <line x1="3" y1="18" x2="21" y2="18"></line>
61
+ </svg>
62
+ </symbol>
63
+ <symbol id="svg-arrow-right" viewBox="0 0 24 24">
64
+ <title>Expand</title>
65
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
66
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
67
+ <polyline points="9 18 15 12 9 6"></polyline>
68
+ </svg>
69
+ </symbol>
70
+ <symbol id="svg-sun" viewBox="0 0 24 24">
71
+ <title>Light mode</title>
72
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
73
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
74
+ <circle cx="12" cy="12" r="5"></circle>
75
+ <line x1="12" y1="1" x2="12" y2="3"></line>
76
+ <line x1="12" y1="21" x2="12" y2="23"></line>
77
+ <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
78
+ <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
79
+ <line x1="1" y1="12" x2="3" y2="12"></line>
80
+ <line x1="21" y1="12" x2="23" y2="12"></line>
81
+ <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
82
+ <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
83
+ </svg>
84
+ </symbol>
85
+ <symbol id="svg-moon" viewBox="0 0 24 24">
86
+ <title>Dark mode</title>
87
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
88
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
89
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
90
+ <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
91
+ </svg>
92
+ </symbol>
93
+ <symbol id="svg-sun-with-moon" viewBox="0 0 24 24">
94
+ <title>Auto light/dark, in light mode</title>
95
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
96
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
97
+ class="icon-custom-derived-from-feather-sun-and-tabler-moon">
98
+ <path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/>
99
+ <line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/>
100
+ <line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/>
101
+ <line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/>
102
+ <line x1="19" y1="14.05" x2="20.414" y2="15.464"/>
103
+ <line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/>
104
+ <line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/>
105
+ <line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/>
106
+ <line x1="19" y1="5.05" x2="20.414" y2="3.636"/>
107
+ <circle cx="14.5" cy="9.55" r="3.6"/>
108
+ </svg>
109
+ </symbol>
110
+ <symbol id="svg-moon-with-sun" viewBox="0 0 24 24">
111
+ <title>Auto light/dark, in dark mode</title>
112
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
113
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
114
+ class="icon-custom-derived-from-feather-sun-and-tabler-moon">
115
+ <path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/>
116
+ <line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/>
117
+ <line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/>
118
+ <line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/>
119
+ <line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/>
120
+ <line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/>
121
+ <line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/>
122
+ <line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/>
123
+ <line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/>
124
+ <circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/>
125
+ </svg>
126
+ </symbol>
127
+ <symbol id="svg-pencil" viewBox="0 0 24 24">
128
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
129
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code">
130
+ <path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" />
131
+ <path d="M13.5 6.5l4 4" />
132
+ <path d="M20 21l2 -2l-2 -2" />
133
+ <path d="M17 17l-2 2l2 2" />
134
+ </svg>
135
+ </symbol>
136
+ <symbol id="svg-eye" viewBox="0 0 24 24">
137
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
138
+ stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code">
139
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
140
+ <path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
141
+ <path
142
+ d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" />
143
+ <path d="M20 21l2 -2l-2 -2" />
144
+ <path d="M17 17l-2 2l2 2" />
145
+ </svg>
146
+ </symbol>
147
+ </svg>
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
+ <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>
157
+
158
+ <a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>
159
+
160
+
161
+
162
+ <div class="page">
163
+ <header class="mobile-header">
164
+ <div class="header-left">
165
+ <label class="nav-overlay-icon" for="__navigation">
166
+ <div class="visually-hidden">Toggle site navigation sidebar</div>
167
+ <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
168
+ </label>
169
+ </div>
170
+ <div class="header-center">
171
+ <a href="index.html"><div class="brand">IBM Envizi - Emissions API Node.js SDK documentation</div></a>
172
+ </div>
173
+ <div class="header-right">
174
+ <div class="theme-toggle-container theme-toggle-header">
175
+ <button class="theme-toggle">
176
+ <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
177
+ <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
178
+ <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
179
+ <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
180
+ <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
181
+ </button>
182
+ </div>
183
+ <label class="toc-overlay-icon toc-header-icon" for="__toc">
184
+ <div class="visually-hidden">Toggle table of contents sidebar</div>
185
+ <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
186
+ </label>
187
+ </div>
188
+ </header>
189
+ <aside class="sidebar-drawer">
190
+ <div class="sidebar-container">
191
+
192
+ <div class="sidebar-sticky"><a class="sidebar-brand" href="index.html">
193
+
194
+ <span class="sidebar-brand-text">IBM Envizi - Emissions API Node.js SDK documentation</span>
195
+
196
+ </a><form class="sidebar-search-container" method="get" action="search.html" role="search">
197
+ <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
198
+ <input type="hidden" name="check_keywords" value="yes">
199
+ <input type="hidden" name="area" value="default">
200
+ </form>
201
+ <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
202
+ <p class="caption" role="heading"><span class="caption-text">Contents:</span></p>
203
+ <ul class="current">
204
+ <li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Getting Started</a></li>
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>
206
+ <li class="toctree-l2"><a class="reference internal" href="client.html">Client</a></li>
207
+ <li class="toctree-l2"><a class="reference internal" href="authentication.html">Authentication</a></li>
208
+ </ul>
209
+ </li>
210
+ <li class="toctree-l1"><a class="reference internal" href="reference.html">Reference</a></li>
211
+ <li class="toctree-l1"><a class="reference internal" href="troubleshooting.html">Troubleshooting Guide</a></li>
212
+ </ul>
213
+
214
+ </div>
215
+ </div>
216
+
217
+ </div>
218
+
219
+ </div>
220
+ </aside>
221
+ <div class="main">
222
+ <div class="content">
223
+ <div class="article-container">
224
+ <a href="#" class="back-to-top muted-link">
225
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
226
+ <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
227
+ </svg>
228
+ <span>Back to top</span>
229
+ </a>
230
+ <div class="content-icon-container">
231
+ <div class="view-this-page">
232
+ <a class="muted-link" href="_sources/getting_started.rst.txt" title="View this page">
233
+ <svg><use href="#svg-eye"></use></svg>
234
+ <span class="visually-hidden">View this page</span>
235
+ </a>
236
+ </div>
237
+ <div class="theme-toggle-container theme-toggle-content">
238
+ <button class="theme-toggle">
239
+ <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
240
+ <svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
241
+ <svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
242
+ <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
243
+ <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
244
+ </button>
245
+ </div>
246
+ <label class="toc-overlay-icon toc-content-icon" for="__toc">
247
+ <div class="visually-hidden">Toggle table of contents sidebar</div>
248
+ <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
249
+ </label>
250
+ </div>
251
+ <article role="main" id="furo-main-content">
252
+ <section id="getting-started">
253
+ <h1>Getting Started<a class="headerlink" href="#getting-started" title="Link to this heading">¶</a></h1>
254
+ <section id="prerequisites">
255
+ <h2>Prerequisites<a class="headerlink" href="#prerequisites" title="Link to this heading">¶</a></h2>
256
+ <p>Before using the SDK, ensure you have:</p>
257
+ <ul class="simple">
258
+ <li><p><strong>Node.js</strong> installed</p></li>
259
+ <li><p>Active internet connection</p></li>
260
+ <li><p>Sign up for the preview waitlist <a class="reference external" href="https://www.ibm.com/account/reg/us-en/signup?formid=urx-53659">IBMid sign up</a> page.</p></li>
261
+ <li><p>API credentials (<code class="docutils literal notranslate"><span class="pre">apiKey</span></code>, <code class="docutils literal notranslate"><span class="pre">tenantId</span></code>, <code class="docutils literal notranslate"><span class="pre">orgId</span></code>), are available on the Emissions API <a class="reference external" href="https://www-dev.supply-chain.ibm.com/envizi/emissions-api-home/overview?cuiURL=%2Femissions-api-home%2Foverview">Overview Page</a> after sign up</p></li>
262
+ </ul>
263
+ </section>
264
+ <section id="installation">
265
+ <h2>Installation<a class="headerlink" href="#installation" title="Link to this heading">¶</a></h2>
266
+ <p>You can install the SDK using <a class="reference external" href="https://www.npmjs.com/package/emissions-api-sdk">npm</a> or <a class="reference external" href="https://yarnpkg.com/package?q=emissions-api-sdk&amp;name=emissions-api-sdk">yarn</a>:</p>
267
+ <p>Using npm:</p>
268
+ <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>npm<span class="w"> </span>install<span class="w"> </span>emissions-api-sdk
269
+ </pre></div>
270
+ </div>
271
+ <p>Using yarn:</p>
272
+ <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>yarn<span class="w"> </span>install<span class="w"> </span>emissions-api-sdk
273
+ </pre></div>
274
+ </div>
275
+ <section id="basic-import">
276
+ <h3>Basic Import<a class="headerlink" href="#basic-import" title="Link to this heading">¶</a></h3>
277
+ <p>After installation, you can import the SDK in your project:</p>
278
+ <div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="c1">// Import the entire SDK</span>
279
+ <span class="kd">const</span><span class="w"> </span><span class="nx">enviziSDK</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;emissions-api-sdk&#39;</span><span class="p">);</span>
280
+
281
+ <span class="c1">// Or using ES modules</span>
282
+ <span class="k">import</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">Client</span><span class="p">,</span><span class="w"> </span><span class="nx">LocationEmission</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="kr">from</span><span class="w"> </span><span class="s1">&#39;emissions-api-sdk&#39;</span><span class="p">;</span>
283
+ </pre></div>
284
+ </div>
285
+ </section>
286
+ </section>
287
+ <section id="authentication">
288
+ <h2>Authentication<a class="headerlink" href="#authentication" title="Link to this heading">¶</a></h2>
289
+ <p>Initialize the client with your API credentials:</p>
290
+ <p>The SDK provides two authentication methods:</p>
291
+ <ul class="simple">
292
+ <li><dl class="simple">
293
+ <dt>Using an <strong>API key</strong> with following required Headers:</dt><dd><ul>
294
+ <li><p><code class="docutils literal notranslate"><span class="pre">X-Api-Key</span></code>: Your API key</p></li>
295
+ <li><p><code class="docutils literal notranslate"><span class="pre">X-IBM-Client-Id</span></code>: saascore-{your-client-id}</p></li>
296
+ <li><p><code class="docutils literal notranslate"><span class="pre">accept</span></code>: application/json</p></li>
297
+ </ul>
298
+ </dd>
299
+ </dl>
300
+ </li>
301
+ <li><dl class="simple">
302
+ <dt>Using a <strong>Pre-generated token</strong></dt><dd><ul>
303
+ <li><p>Token Generation Endpoint: <a class="reference external" href="https://api.ibm.com/saascore/run/authentication-retrieve/api-key">https://api.ibm.com/saascore/run/authentication-retrieve/api-key</a></p></li>
304
+ </ul>
305
+ </dd>
306
+ </dl>
307
+ </li>
308
+ </ul>
309
+ <section id="using-api-key-recommended">
310
+ <h3>Using API Key (Recommended)<a class="headerlink" href="#using-api-key-recommended" title="Link to this heading">¶</a></h3>
311
+ <div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="k">import</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">Client</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="kr">from</span><span class="w"> </span><span class="s1">&#39;emissions-api-sdk&#39;</span><span class="p">;</span>
312
+
313
+ <span class="k">async</span><span class="w"> </span><span class="kd">function</span><span class="w"> </span><span class="nx">initialize</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
314
+ <span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="p">{</span>
315
+ <span class="w"> </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>
316
+ <span class="w"> </span><span class="nx">apiKey</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-api-key&quot;</span><span class="p">,</span>
317
+ <span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-client-id&quot;</span><span class="p">,</span>
318
+ <span class="w"> </span><span class="nx">orgId</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-org-id&quot;</span>
319
+ <span class="w"> </span><span class="p">});</span>
320
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Client initialized successfully&quot;</span><span class="p">);</span>
321
+ <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">catch</span><span class="w"> </span><span class="p">(</span><span class="nx">error</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
322
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">&quot;Failed to initialize client:&quot;</span><span class="p">,</span><span class="w"> </span><span class="nx">error</span><span class="p">);</span>
323
+ <span class="w"> </span><span class="p">}</span>
324
+ <span class="p">}</span>
325
+
326
+ <span class="nx">initialize</span><span class="p">();</span>
327
+ </pre></div>
328
+ </div>
329
+ </section>
330
+ <section id="using-pre-generated-token">
331
+ <h3>Using Pre-generated Token<a class="headerlink" href="#using-pre-generated-token" title="Link to this heading">¶</a></h3>
332
+ <p>If you already have a token, you can use it directly:</p>
333
+ <div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="k">import</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">Client</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="kr">from</span><span class="w"> </span><span class="s1">&#39;emissions-api-sdk&#39;</span><span class="p">;</span>
334
+
335
+ <span class="k">async</span><span class="w"> </span><span class="kd">function</span><span class="w"> </span><span class="nx">initialize</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
336
+ <span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="p">{</span>
337
+ <span class="w"> </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">token</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-pre-generated-token&quot;</span><span class="p">,</span>
339
+ <span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-client-id&quot;</span>
340
+ <span class="w"> </span><span class="p">});</span>
341
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Client initialized successfully&quot;</span><span class="p">);</span>
342
+ <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">catch</span><span class="w"> </span><span class="p">(</span><span class="nx">error</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
343
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">&quot;Failed to initialize client:&quot;</span><span class="p">,</span><span class="w"> </span><span class="nx">error</span><span class="p">);</span>
344
+ <span class="w"> </span><span class="p">}</span>
345
+ <span class="p">}</span>
346
+
347
+ <span class="nx">initialize</span><span class="p">();</span>
348
+ </pre></div>
349
+ </div>
350
+ </section>
351
+ </section>
352
+ <section id="first-api-call">
353
+ <h2>First API Call<a class="headerlink" href="#first-api-call" title="Link to this heading">¶</a></h2>
354
+ <p>After initializing the client, you can make your first API call. Here’s an example of calculating location-based emissions:</p>
355
+ <div class="highlight-javascript notranslate"><div class="highlight"><pre><span></span><span class="k">import</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">Client</span><span class="p">,</span><span class="w"> </span><span class="nx">LocationEmission</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="kr">from</span><span class="w"> </span><span class="s1">&#39;emissions-api-sdk&#39;</span><span class="p">;</span>
356
+
357
+ <span class="k">async</span><span class="w"> </span><span class="kd">function</span><span class="w"> </span><span class="nx">calculateEmissions</span><span class="p">()</span><span class="w"> </span><span class="p">{</span>
358
+ <span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="p">{</span>
359
+ <span class="w"> </span><span class="c1">// Initialize client</span>
360
+ <span class="w"> </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>
361
+ <span class="w"> </span><span class="nx">apiKey</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-api-key&quot;</span><span class="p">,</span>
362
+ <span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-client-id&quot;</span><span class="p">,</span>
363
+ <span class="w"> </span><span class="nx">orgId</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;your-org-id&quot;</span>
364
+ <span class="w"> </span><span class="p">});</span>
365
+
366
+ <span class="w"> </span><span class="c1">// Make API call</span>
367
+ <span class="w"> </span><span class="kd">const</span><span class="w"> </span><span class="nx">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">await</span><span class="w"> </span><span class="nx">LocationEmission</span><span class="p">.</span><span class="nx">calculate</span><span class="p">({</span>
368
+ <span class="w"> </span><span class="s2">&quot;location&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
369
+ <span class="w"> </span><span class="s2">&quot;country&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;USA&quot;</span><span class="p">,</span>
370
+ <span class="w"> </span><span class="s2">&quot;stateProvince&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;california&quot;</span>
371
+ <span class="w"> </span><span class="p">},</span>
372
+ <span class="w"> </span><span class="s2">&quot;activity&quot;</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
373
+ <span class="w"> </span><span class="s2">&quot;type&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;electricity&quot;</span><span class="p">,</span>
374
+ <span class="w"> </span><span class="s2">&quot;value&quot;</span><span class="o">:</span><span class="w"> </span><span class="mf">1</span><span class="p">,</span>
375
+ <span class="w"> </span><span class="s2">&quot;unit&quot;</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;kWh&quot;</span>
376
+ <span class="w"> </span><span class="p">}</span>
377
+ <span class="w"> </span><span class="p">});</span>
378
+
379
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">&quot;Emission calculation result:&quot;</span><span class="p">,</span><span class="w"> </span><span class="nx">result</span><span class="p">);</span>
380
+ <span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="k">catch</span><span class="w"> </span><span class="p">(</span><span class="nx">error</span><span class="p">)</span><span class="w"> </span><span class="p">{</span>
381
+ <span class="w"> </span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">(</span><span class="s2">&quot;Error calculating emissions:&quot;</span><span class="p">,</span><span class="w"> </span><span class="nx">error</span><span class="p">);</span>
382
+ <span class="w"> </span><span class="p">}</span>
383
+ <span class="p">}</span>
384
+
385
+ <span class="nx">calculateEmissions</span><span class="p">();</span>
386
+ </pre></div>
387
+ </div>
388
+ </section>
389
+ <section id="example-response">
390
+ <h2>Example Response<a class="headerlink" href="#example-response" title="Link to this heading">¶</a></h2>
391
+ <p>The API returns emission calculation results in JSON format. Here’s an example response:</p>
392
+ <div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
393
+ <span class="w"> </span><span class="nt">&quot;transactionId&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;95a7efe7-02ae-47a3-a7fd-831bfca7cecd&quot;</span><span class="p">,</span>
394
+ <span class="w"> </span><span class="nt">&quot;totalCO2e&quot;</span><span class="p">:</span><span class="w"> </span><span class="mf">0.20750174</span><span class="p">,</span>
395
+ <span class="w"> </span><span class="nt">&quot;CO2&quot;</span><span class="p">:</span><span class="w"> </span><span class="mf">0.20681091</span><span class="p">,</span>
396
+ <span class="w"> </span><span class="nt">&quot;CH4&quot;</span><span class="p">:</span><span class="w"> </span><span class="mf">0.00033022</span><span class="p">,</span>
397
+ <span class="w"> </span><span class="nt">&quot;N2O&quot;</span><span class="p">:</span><span class="w"> </span><span class="mf">0.00036061</span><span class="p">,</span>
398
+ <span class="w"> </span><span class="nt">&quot;indirectCO2e&quot;</span><span class="p">:</span><span class="w"> </span><span class="mf">0.01115131</span><span class="p">,</span>
399
+ <span class="w"> </span><span class="nt">&quot;unit&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;kgCO2e&quot;</span><span class="p">,</span>
400
+ <span class="w"> </span><span class="nt">&quot;description&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;The electricity emissions factor used to calculate this result was obtained from the year 2022 Managed - eGRID &amp; US Climate Leaders factor set for the area United States and the region California.&quot;</span>
401
+ <span class="p">}</span>
402
+ </pre></div>
403
+ </div>
404
+ </section>
405
+ </section>
406
+
407
+ </article>
408
+ </div>
409
+ <footer>
410
+
411
+ <div class="related-pages">
412
+ <a class="next-page" href="sdk.html">
413
+ <div class="page-info">
414
+ <div class="context">
415
+ <span>Next</span>
416
+ </div>
417
+ <div class="title">SDK</div>
418
+ </div>
419
+ <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
420
+ </a>
421
+ <a class="prev-page" href="index.html">
422
+ <svg class="furo-related-icon"><use href="#svg-arrow-right"></use></svg>
423
+ <div class="page-info">
424
+ <div class="context">
425
+ <span>Previous</span>
426
+ </div>
427
+
428
+ <div class="title">Home</div>
429
+
430
+ </div>
431
+ </a>
432
+ </div>
433
+ <div class="bottom-of-page">
434
+ <div class="left-details">
435
+ <div class="copyright">
436
+ Copyright &#169; 2025, IBM Corporation
437
+ </div>
438
+ Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
439
+
440
+ <a href="https://github.com/pradyunsg/furo">Furo</a>
441
+
442
+ </div>
443
+ <div class="right-details">
444
+
445
+ </div>
446
+ </div>
447
+
448
+ </footer>
449
+ </div>
450
+ <aside class="toc-drawer">
451
+
452
+
453
+ <div class="toc-sticky toc-scroll">
454
+ <div class="toc-title-container">
455
+ <span class="toc-title">
456
+ On this page
457
+ </span>
458
+ </div>
459
+ <div class="toc-tree-container">
460
+ <div class="toc-tree">
461
+ <ul>
462
+ <li><a class="reference internal" href="#">Getting Started</a><ul>
463
+ <li><a class="reference internal" href="#prerequisites">Prerequisites</a></li>
464
+ <li><a class="reference internal" href="#installation">Installation</a><ul>
465
+ <li><a class="reference internal" href="#basic-import">Basic Import</a></li>
466
+ </ul>
467
+ </li>
468
+ <li><a class="reference internal" href="#authentication">Authentication</a><ul>
469
+ <li><a class="reference internal" href="#using-api-key-recommended">Using API Key (Recommended)</a></li>
470
+ <li><a class="reference internal" href="#using-pre-generated-token">Using Pre-generated Token</a></li>
471
+ </ul>
472
+ </li>
473
+ <li><a class="reference internal" href="#first-api-call">First API Call</a></li>
474
+ <li><a class="reference internal" href="#example-response">Example Response</a></li>
475
+ </ul>
476
+ </li>
477
+ </ul>
478
+
479
+ </div>
480
+ </div>
481
+ </div>
482
+
483
+
484
+ </aside>
485
+ </div>
486
+ </div><script src="_static/documentation_options.js?v=5929fcd5"></script>
487
+ <script src="_static/doctools.js?v=9bcbadda"></script>
488
+ <script src="_static/sphinx_highlight.js?v=dc90522c"></script>
489
+ <script src="_static/scripts/furo.js?v=46bd48cc"></script>
490
+ </body>
491
+ </html>