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.
- package/README.md +33 -2
- package/dist/Constants.js +23 -1
- package/dist/api/Calculation.js +78 -15
- package/dist/api/Factor.js +99 -18
- package/dist/api/FactorSets.js +1 -1
- package/dist/api/Fugitive.js +76 -13
- package/dist/api/Location.js +76 -15
- package/dist/api/Mobile.js +65 -1
- package/dist/api/Stationary.js +78 -15
- package/dist/api/TransportationAndDistribution.js +77 -14
- package/dist/coverage/clover.xml +191 -81
- package/dist/coverage/coverage-final.json +11 -11
- package/dist/coverage/lcov-report/index.html +16 -16
- package/dist/coverage/lcov-report/src/Client.ts.html +23 -23
- package/dist/coverage/lcov-report/src/Constants.ts.html +82 -4
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +245 -26
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +313 -34
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +8 -5
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +246 -24
- package/dist/coverage/lcov-report/src/api/Location.ts.html +245 -26
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +240 -12
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +248 -26
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +250 -25
- package/dist/coverage/lcov-report/src/api/index.html +25 -25
- package/dist/coverage/lcov-report/src/index.html +7 -7
- package/dist/coverage/lcov-report/src/request.ts.html +1 -1
- package/dist/coverage/lcov-report/src/utils.ts.html +5 -5
- 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 +287 -133
- package/dist/interfaces/response/AreaResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
- package/dist/interfaces/response/FactorResponse.js +2 -0
- package/dist/interfaces/response/FactorSetResponse.js +2 -0
- package/dist/interfaces/response/SearchResponse.js +2 -0
- package/dist/interfaces/response/TypeResponse.js +2 -0
- package/dist/interfaces/response/UnitResponse.js +2 -0
- package/dist/types/Constants.d.ts +22 -0
- package/dist/types/api/Calculation.d.ts +59 -16
- package/dist/types/api/Factor.d.ts +73 -20
- package/dist/types/api/FactorSets.d.ts +3 -2
- package/dist/types/api/Fugitive.d.ts +57 -14
- package/dist/types/api/Location.d.ts +57 -16
- package/dist/types/api/Mobile.d.ts +46 -2
- package/dist/types/api/Stationary.d.ts +59 -16
- package/dist/types/api/TransportationAndDistribution.d.ts +58 -15
- package/dist/types/index.d.ts +8 -0
- package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
- package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
- package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
- package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
- package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
- package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
- package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
- package/dist/types/interfaces/response/UnitResponse.d.ts +7 -0
- package/docs/.nojekyll +0 -0
- package/docs/_sources/authentication.rst.txt +164 -0
- package/docs/_sources/client.rst.txt +137 -0
- package/docs/_sources/getting_started.rst.txt +164 -0
- package/docs/_sources/index.rst.txt +30 -0
- package/docs/_sources/reference.rst.txt +129 -0
- package/docs/_sources/sdk.rst.txt +13 -0
- package/docs/_sources/troubleshooting.rst.txt +486 -0
- package/docs/_static/basic.css +914 -0
- package/docs/_static/custom.css +16 -0
- package/docs/_static/debug.css +69 -0
- package/docs/_static/doctools.js +149 -0
- package/docs/_static/documentation_options.js +13 -0
- package/docs/_static/file.png +0 -0
- package/docs/_static/language_data.js +192 -0
- package/docs/_static/minus.png +0 -0
- package/docs/_static/plus.png +0 -0
- package/docs/_static/pygments.css +232 -0
- package/docs/_static/scripts/furo-extensions.js +0 -0
- package/docs/_static/scripts/furo.js +3 -0
- package/docs/_static/scripts/furo.js.LICENSE.txt +7 -0
- package/docs/_static/scripts/furo.js.map +1 -0
- package/docs/_static/searchtools.js +632 -0
- package/docs/_static/skeleton.css +296 -0
- package/docs/_static/sphinx_highlight.js +154 -0
- package/docs/_static/sphinx_js.css +0 -0
- package/docs/_static/styles/furo-extensions.css +2 -0
- package/docs/_static/styles/furo-extensions.css.map +1 -0
- package/docs/_static/styles/furo.css +2 -0
- package/docs/_static/styles/furo.css.map +1 -0
- package/docs/authentication.html +523 -0
- package/docs/client.html +477 -0
- package/docs/genindex.html +492 -0
- package/docs/getting_started.html +491 -0
- package/docs/index.html +357 -0
- package/docs/objects.inv +0 -0
- package/docs/reference.html +1584 -0
- package/docs/sdk.html +334 -0
- package/docs/search.html +297 -0
- package/docs/searchindex.js +1 -0
- package/docs/troubleshooting.html +786 -0
- package/package.json +1 -1
- package/sphinx-build/Makefile +49 -0
- package/sphinx-build/requirements.txt +5 -0
- package/sphinx-build/source/_static/custom.css +16 -0
- package/sphinx-build/source/authentication.rst +164 -0
- package/sphinx-build/source/client.rst +137 -0
- package/sphinx-build/source/conf.py +56 -0
- package/sphinx-build/source/getting_started.rst +164 -0
- package/sphinx-build/source/index.rst +30 -0
- package/sphinx-build/source/reference.rst +129 -0
- package/sphinx-build/source/sdk.rst +13 -0
- package/sphinx-build/source/troubleshooting.rst +486 -0
- package/src/Constants.ts +26 -0
- package/src/api/Calculation.ts +94 -20
- package/src/api/Factor.ts +122 -28
- package/src/api/FactorSets.ts +4 -3
- package/src/api/Fugitive.ts +93 -18
- package/src/api/Location.ts +94 -20
- package/src/api/Mobile.ts +83 -6
- package/src/api/Stationary.ts +95 -20
- package/src/api/TransportationAndDistribution.ts +95 -19
- package/src/index.ts +33 -1
- package/src/interfaces/response/AreaResponse.ts +25 -0
- package/src/interfaces/response/EmissionResponse.ts +44 -0
- package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
- package/src/interfaces/response/FactorResponse.ts +78 -0
- package/src/interfaces/response/FactorSetResponse.ts +52 -0
- package/src/interfaces/response/SearchResponse.ts +52 -0
- package/src/interfaces/response/TypeResponse.ts +7 -0
- package/src/interfaces/response/UnitResponse.ts +7 -0
- package/test/apiTest.test.ts +173 -6
- package/dist/api/Factors.js +0 -98
- package/dist/api/FugitiveEmission.js +0 -40
- package/dist/api/GenericCalculation.js +0 -41
- package/dist/api/LocationEmission.js +0 -41
- package/dist/api/MobileEmission.js +0 -41
- package/dist/api/StationaryEmission.js +0 -41
- package/dist/api/TransportationDistributionEmission.js +0 -40
- package/dist/coverage/lcov-report/src/api/Factors.ts.html +0 -403
- package/dist/coverage/lcov-report/src/api/FugitiveEmission.ts.html +0 -214
- package/dist/coverage/lcov-report/src/api/GenericCalculation.ts.html +0 -217
- package/dist/coverage/lcov-report/src/api/LocationEmission.ts.html +0 -214
- package/dist/coverage/lcov-report/src/api/MobileEmission.ts.html +0 -220
- package/dist/coverage/lcov-report/src/api/StationaryEmission.ts.html +0 -220
- package/dist/coverage/lcov-report/src/api/TransportationDistributionEmission.ts.html +0 -211
- package/dist/types/api/Factors.d.ts +0 -68
- package/dist/types/api/FugitiveEmission.d.ts +0 -27
- package/dist/types/api/GenericCalculation.d.ts +0 -28
- package/dist/types/api/LocationEmission.d.ts +0 -28
- package/dist/types/api/MobileEmission.d.ts +0 -28
- package/dist/types/api/StationaryEmission.d.ts +0 -28
- package/dist/types/api/TransportationDistributionEmission.d.ts +0 -27
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
26
|
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>38/38</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
47
|
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>38/38</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -78,7 +78,33 @@
|
|
|
78
78
|
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
79
|
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
80
|
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
-
<a name='L16'></a><a href='#L16'>16</a
|
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
|
96
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
|
97
|
+
<a name='L32'></a><a href='#L32'>32</a>
|
|
98
|
+
<a name='L33'></a><a href='#L33'>33</a>
|
|
99
|
+
<a name='L34'></a><a href='#L34'>34</a>
|
|
100
|
+
<a name='L35'></a><a href='#L35'>35</a>
|
|
101
|
+
<a name='L36'></a><a href='#L36'>36</a>
|
|
102
|
+
<a name='L37'></a><a href='#L37'>37</a>
|
|
103
|
+
<a name='L38'></a><a href='#L38'>38</a>
|
|
104
|
+
<a name='L39'></a><a href='#L39'>39</a>
|
|
105
|
+
<a name='L40'></a><a href='#L40'>40</a>
|
|
106
|
+
<a name='L41'></a><a href='#L41'>41</a>
|
|
107
|
+
<a name='L42'></a><a href='#L42'>42</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">4x</span>
|
|
82
108
|
<span class="cline-any cline-yes">4x</span>
|
|
83
109
|
<span class="cline-any cline-yes">4x</span>
|
|
84
110
|
<span class="cline-any cline-yes">4x</span>
|
|
@@ -89,6 +115,32 @@
|
|
|
89
115
|
<span class="cline-any cline-yes">4x</span>
|
|
90
116
|
<span class="cline-any cline-yes">4x</span>
|
|
91
117
|
<span class="cline-any cline-yes">4x</span>
|
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
|
119
|
+
<span class="cline-any cline-yes">4x</span>
|
|
120
|
+
<span class="cline-any cline-yes">4x</span>
|
|
121
|
+
<span class="cline-any cline-yes">4x</span>
|
|
122
|
+
<span class="cline-any cline-yes">4x</span>
|
|
123
|
+
<span class="cline-any cline-yes">4x</span>
|
|
124
|
+
<span class="cline-any cline-yes">4x</span>
|
|
125
|
+
<span class="cline-any cline-yes">4x</span>
|
|
126
|
+
<span class="cline-any cline-neutral"> </span>
|
|
127
|
+
<span class="cline-any cline-yes">4x</span>
|
|
128
|
+
<span class="cline-any cline-yes">4x</span>
|
|
129
|
+
<span class="cline-any cline-yes">4x</span>
|
|
130
|
+
<span class="cline-any cline-yes">4x</span>
|
|
131
|
+
<span class="cline-any cline-yes">4x</span>
|
|
132
|
+
<span class="cline-any cline-yes">4x</span>
|
|
133
|
+
<span class="cline-any cline-yes">4x</span>
|
|
134
|
+
<span class="cline-any cline-yes">4x</span>
|
|
135
|
+
<span class="cline-any cline-neutral"> </span>
|
|
136
|
+
<span class="cline-any cline-yes">4x</span>
|
|
137
|
+
<span class="cline-any cline-yes">4x</span>
|
|
138
|
+
<span class="cline-any cline-yes">4x</span>
|
|
139
|
+
<span class="cline-any cline-yes">4x</span>
|
|
140
|
+
<span class="cline-any cline-yes">4x</span>
|
|
141
|
+
<span class="cline-any cline-yes">4x</span>
|
|
142
|
+
<span class="cline-any cline-yes">4x</span>
|
|
143
|
+
<span class="cline-any cline-neutral"> </span>
|
|
92
144
|
<span class="cline-any cline-yes">4x</span>
|
|
93
145
|
<span class="cline-any cline-yes">4x</span>
|
|
94
146
|
<span class="cline-any cline-yes">4x</span>
|
|
@@ -104,6 +156,32 @@ export const TRANSPORTATION_AND_DISTRIBUTION_API_PATH = "/v3/carbon/transportati
|
|
|
104
156
|
export const FACTOR_API_PATH = "/v3/carbon/factor";
|
|
105
157
|
export const FACTOR_SET_API_PATH = "/v3/carbon/factorset";
|
|
106
158
|
export const SEARCH_API_PATH = "/v3/carbon/factor/search";
|
|
159
|
+
|
|
160
|
+
export const CALCULATION_TYPES = "/v3/carbon/calculation/types";
|
|
161
|
+
export const LOCATION_TYPES = "/v3/carbon/location/types";
|
|
162
|
+
export const FUGITIVE_API_TYPES = "/v3/carbon/fugitive/types";
|
|
163
|
+
export const MOBILE_API_TYPES = "/v3/carbon/mobile/types";
|
|
164
|
+
export const STATIONARY_API_TYPES = "/v3/carbon/stationary/types";
|
|
165
|
+
export const FACTOR_API_TYPES = "/v3/carbon/factor/types";
|
|
166
|
+
export const TRANSPORTATION_AND_DISTRIBUTION_API_TYPES = "/v3/carbon/transportation-and-distribution/types";
|
|
167
|
+
|
|
168
|
+
export const FUGITIVE_API_AREA = "/v3/carbon/fugitive/area";
|
|
169
|
+
export const GENERAL_API_AREA = "/v3/carbon/calculation/area";
|
|
170
|
+
export const LOCATION_API_AREA = "/v3/carbon/location/area";
|
|
171
|
+
export const MOBILE_API_AREA = "/v3/carbon/mobile/area";
|
|
172
|
+
export const STATIONARY_API_AREA = "/v3/carbon/stationary/area";
|
|
173
|
+
export const TRANSPORTATION_AND_DISTRIBUTION_API_AREA = "/v3/carbon/transportation-and-distribution/area";
|
|
174
|
+
export const SEARCH_API_AREA = "/v3/carbon/factor/search/area";
|
|
175
|
+
export const FACTOR_API_AREA = "/v3/carbon/factor/area";
|
|
176
|
+
|
|
177
|
+
export const FUGITIVE_API_UNITS = "/v3/carbon/fugitive/units";
|
|
178
|
+
export const LOCATION_API_UNITS = "/v3/carbon/location/units";
|
|
179
|
+
export const MOBILE_API_UNITS = "/v3/carbon/mobile/units";
|
|
180
|
+
export const STATIONARY_API_UNITS = "/v3/carbon/stationary/units";
|
|
181
|
+
export const GENERAL_API_UNITS = "/v3/carbon/calculation/units";
|
|
182
|
+
export const FACTOR_API_UNITS = "/v3/carbon/factor/units";
|
|
183
|
+
export const TRANSPORTATION_AND_DISTRIBUTION_API_UNITS = "/v3/carbon/transportation-and-distribution/units";
|
|
184
|
+
|
|
107
185
|
export const GET = "GET";
|
|
108
186
|
export const POST = "POST";
|
|
109
187
|
export const CLIENT_SOURCE_HEADER = "X-Client-Source";
|
|
@@ -115,7 +193,7 @@ export const CLIENT_SOURCE_SDK = "node-sdk";</pre></td></tr></table></pre>
|
|
|
115
193
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
116
194
|
Code coverage generated by
|
|
117
195
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
118
|
-
at 2025-
|
|
196
|
+
at 2025-12-11T17:06:20.018Z
|
|
119
197
|
</div>
|
|
120
198
|
<script src="../prettify.js"></script>
|
|
121
199
|
<script>
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
26
|
<span class="strong">100% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>19/19</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
40
|
<span class="strong">100% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>4/4</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
47
|
<span class="strong">100% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>19/19</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -107,9 +107,87 @@
|
|
|
107
107
|
<a name='L42'></a><a href='#L42'>42</a>
|
|
108
108
|
<a name='L43'></a><a href='#L43'>43</a>
|
|
109
109
|
<a name='L44'></a><a href='#L44'>44</a>
|
|
110
|
-
<a name='L45'></a><a href='#L45'>45</a
|
|
110
|
+
<a name='L45'></a><a href='#L45'>45</a>
|
|
111
|
+
<a name='L46'></a><a href='#L46'>46</a>
|
|
112
|
+
<a name='L47'></a><a href='#L47'>47</a>
|
|
113
|
+
<a name='L48'></a><a href='#L48'>48</a>
|
|
114
|
+
<a name='L49'></a><a href='#L49'>49</a>
|
|
115
|
+
<a name='L50'></a><a href='#L50'>50</a>
|
|
116
|
+
<a name='L51'></a><a href='#L51'>51</a>
|
|
117
|
+
<a name='L52'></a><a href='#L52'>52</a>
|
|
118
|
+
<a name='L53'></a><a href='#L53'>53</a>
|
|
119
|
+
<a name='L54'></a><a href='#L54'>54</a>
|
|
120
|
+
<a name='L55'></a><a href='#L55'>55</a>
|
|
121
|
+
<a name='L56'></a><a href='#L56'>56</a>
|
|
122
|
+
<a name='L57'></a><a href='#L57'>57</a>
|
|
123
|
+
<a name='L58'></a><a href='#L58'>58</a>
|
|
124
|
+
<a name='L59'></a><a href='#L59'>59</a>
|
|
125
|
+
<a name='L60'></a><a href='#L60'>60</a>
|
|
126
|
+
<a name='L61'></a><a href='#L61'>61</a>
|
|
127
|
+
<a name='L62'></a><a href='#L62'>62</a>
|
|
128
|
+
<a name='L63'></a><a href='#L63'>63</a>
|
|
129
|
+
<a name='L64'></a><a href='#L64'>64</a>
|
|
130
|
+
<a name='L65'></a><a href='#L65'>65</a>
|
|
131
|
+
<a name='L66'></a><a href='#L66'>66</a>
|
|
132
|
+
<a name='L67'></a><a href='#L67'>67</a>
|
|
133
|
+
<a name='L68'></a><a href='#L68'>68</a>
|
|
134
|
+
<a name='L69'></a><a href='#L69'>69</a>
|
|
135
|
+
<a name='L70'></a><a href='#L70'>70</a>
|
|
136
|
+
<a name='L71'></a><a href='#L71'>71</a>
|
|
137
|
+
<a name='L72'></a><a href='#L72'>72</a>
|
|
138
|
+
<a name='L73'></a><a href='#L73'>73</a>
|
|
139
|
+
<a name='L74'></a><a href='#L74'>74</a>
|
|
140
|
+
<a name='L75'></a><a href='#L75'>75</a>
|
|
141
|
+
<a name='L76'></a><a href='#L76'>76</a>
|
|
142
|
+
<a name='L77'></a><a href='#L77'>77</a>
|
|
143
|
+
<a name='L78'></a><a href='#L78'>78</a>
|
|
144
|
+
<a name='L79'></a><a href='#L79'>79</a>
|
|
145
|
+
<a name='L80'></a><a href='#L80'>80</a>
|
|
146
|
+
<a name='L81'></a><a href='#L81'>81</a>
|
|
147
|
+
<a name='L82'></a><a href='#L82'>82</a>
|
|
148
|
+
<a name='L83'></a><a href='#L83'>83</a>
|
|
149
|
+
<a name='L84'></a><a href='#L84'>84</a>
|
|
150
|
+
<a name='L85'></a><a href='#L85'>85</a>
|
|
151
|
+
<a name='L86'></a><a href='#L86'>86</a>
|
|
152
|
+
<a name='L87'></a><a href='#L87'>87</a>
|
|
153
|
+
<a name='L88'></a><a href='#L88'>88</a>
|
|
154
|
+
<a name='L89'></a><a href='#L89'>89</a>
|
|
155
|
+
<a name='L90'></a><a href='#L90'>90</a>
|
|
156
|
+
<a name='L91'></a><a href='#L91'>91</a>
|
|
157
|
+
<a name='L92'></a><a href='#L92'>92</a>
|
|
158
|
+
<a name='L93'></a><a href='#L93'>93</a>
|
|
159
|
+
<a name='L94'></a><a href='#L94'>94</a>
|
|
160
|
+
<a name='L95'></a><a href='#L95'>95</a>
|
|
161
|
+
<a name='L96'></a><a href='#L96'>96</a>
|
|
162
|
+
<a name='L97'></a><a href='#L97'>97</a>
|
|
163
|
+
<a name='L98'></a><a href='#L98'>98</a>
|
|
164
|
+
<a name='L99'></a><a href='#L99'>99</a>
|
|
165
|
+
<a name='L100'></a><a href='#L100'>100</a>
|
|
166
|
+
<a name='L101'></a><a href='#L101'>101</a>
|
|
167
|
+
<a name='L102'></a><a href='#L102'>102</a>
|
|
168
|
+
<a name='L103'></a><a href='#L103'>103</a>
|
|
169
|
+
<a name='L104'></a><a href='#L104'>104</a>
|
|
170
|
+
<a name='L105'></a><a href='#L105'>105</a>
|
|
171
|
+
<a name='L106'></a><a href='#L106'>106</a>
|
|
172
|
+
<a name='L107'></a><a href='#L107'>107</a>
|
|
173
|
+
<a name='L108'></a><a href='#L108'>108</a>
|
|
174
|
+
<a name='L109'></a><a href='#L109'>109</a>
|
|
175
|
+
<a name='L110'></a><a href='#L110'>110</a>
|
|
176
|
+
<a name='L111'></a><a href='#L111'>111</a>
|
|
177
|
+
<a name='L112'></a><a href='#L112'>112</a>
|
|
178
|
+
<a name='L113'></a><a href='#L113'>113</a>
|
|
179
|
+
<a name='L114'></a><a href='#L114'>114</a>
|
|
180
|
+
<a name='L115'></a><a href='#L115'>115</a>
|
|
181
|
+
<a name='L116'></a><a href='#L116'>116</a>
|
|
182
|
+
<a name='L117'></a><a href='#L117'>117</a>
|
|
183
|
+
<a name='L118'></a><a href='#L118'>118</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
|
|
111
184
|
<span class="cline-any cline-yes">1x</span>
|
|
112
185
|
<span class="cline-any cline-neutral"> </span>
|
|
186
|
+
<span class="cline-any cline-neutral"> </span>
|
|
187
|
+
<span class="cline-any cline-neutral"> </span>
|
|
188
|
+
<span class="cline-any cline-neutral"> </span>
|
|
189
|
+
<span class="cline-any cline-neutral"> </span>
|
|
190
|
+
<span class="cline-any cline-neutral"> </span>
|
|
113
191
|
<span class="cline-any cline-yes">1x</span>
|
|
114
192
|
<span class="cline-any cline-neutral"> </span>
|
|
115
193
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -151,58 +229,199 @@
|
|
|
151
229
|
<span class="cline-any cline-neutral"> </span>
|
|
152
230
|
<span class="cline-any cline-neutral"> </span>
|
|
153
231
|
<span class="cline-any cline-neutral"> </span>
|
|
232
|
+
<span class="cline-any cline-neutral"> </span>
|
|
233
|
+
<span class="cline-any cline-neutral"> </span>
|
|
234
|
+
<span class="cline-any cline-neutral"> </span>
|
|
235
|
+
<span class="cline-any cline-neutral"> </span>
|
|
236
|
+
<span class="cline-any cline-neutral"> </span>
|
|
237
|
+
<span class="cline-any cline-neutral"> </span>
|
|
238
|
+
<span class="cline-any cline-neutral"> </span>
|
|
239
|
+
<span class="cline-any cline-neutral"> </span>
|
|
240
|
+
<span class="cline-any cline-neutral"> </span>
|
|
241
|
+
<span class="cline-any cline-neutral"> </span>
|
|
242
|
+
<span class="cline-any cline-neutral"> </span>
|
|
243
|
+
<span class="cline-any cline-neutral"> </span>
|
|
244
|
+
<span class="cline-any cline-yes">1x</span>
|
|
245
|
+
<span class="cline-any cline-yes">1x</span>
|
|
246
|
+
<span class="cline-any cline-yes">1x</span>
|
|
247
|
+
<span class="cline-any cline-neutral"> </span>
|
|
248
|
+
<span class="cline-any cline-yes">1x</span>
|
|
249
|
+
<span class="cline-any cline-neutral"> </span>
|
|
250
|
+
<span class="cline-any cline-neutral"> </span>
|
|
251
|
+
<span class="cline-any cline-neutral"> </span>
|
|
252
|
+
<span class="cline-any cline-neutral"> </span>
|
|
253
|
+
<span class="cline-any cline-neutral"> </span>
|
|
254
|
+
<span class="cline-any cline-neutral"> </span>
|
|
255
|
+
<span class="cline-any cline-neutral"> </span>
|
|
256
|
+
<span class="cline-any cline-neutral"> </span>
|
|
257
|
+
<span class="cline-any cline-neutral"> </span>
|
|
258
|
+
<span class="cline-any cline-neutral"> </span>
|
|
259
|
+
<span class="cline-any cline-neutral"> </span>
|
|
260
|
+
<span class="cline-any cline-neutral"> </span>
|
|
261
|
+
<span class="cline-any cline-neutral"> </span>
|
|
262
|
+
<span class="cline-any cline-neutral"> </span>
|
|
263
|
+
<span class="cline-any cline-neutral"> </span>
|
|
264
|
+
<span class="cline-any cline-yes">1x</span>
|
|
265
|
+
<span class="cline-any cline-yes">1x</span>
|
|
266
|
+
<span class="cline-any cline-yes">1x</span>
|
|
267
|
+
<span class="cline-any cline-neutral"> </span>
|
|
268
|
+
<span class="cline-any cline-yes">1x</span>
|
|
269
|
+
<span class="cline-any cline-neutral"> </span>
|
|
270
|
+
<span class="cline-any cline-neutral"> </span>
|
|
271
|
+
<span class="cline-any cline-neutral"> </span>
|
|
272
|
+
<span class="cline-any cline-neutral"> </span>
|
|
273
|
+
<span class="cline-any cline-neutral"> </span>
|
|
274
|
+
<span class="cline-any cline-neutral"> </span>
|
|
275
|
+
<span class="cline-any cline-neutral"> </span>
|
|
276
|
+
<span class="cline-any cline-neutral"> </span>
|
|
277
|
+
<span class="cline-any cline-neutral"> </span>
|
|
278
|
+
<span class="cline-any cline-neutral"> </span>
|
|
279
|
+
<span class="cline-any cline-neutral"> </span>
|
|
280
|
+
<span class="cline-any cline-neutral"> </span>
|
|
281
|
+
<span class="cline-any cline-neutral"> </span>
|
|
282
|
+
<span class="cline-any cline-neutral"> </span>
|
|
283
|
+
<span class="cline-any cline-neutral"> </span>
|
|
284
|
+
<span class="cline-any cline-neutral"> </span>
|
|
285
|
+
<span class="cline-any cline-neutral"> </span>
|
|
286
|
+
<span class="cline-any cline-neutral"> </span>
|
|
287
|
+
<span class="cline-any cline-neutral"> </span>
|
|
288
|
+
<span class="cline-any cline-neutral"> </span>
|
|
289
|
+
<span class="cline-any cline-yes">1x</span>
|
|
290
|
+
<span class="cline-any cline-neutral"> </span>
|
|
291
|
+
<span class="cline-any cline-neutral"> </span>
|
|
292
|
+
<span class="cline-any cline-yes">1x</span>
|
|
293
|
+
<span class="cline-any cline-yes">1x</span>
|
|
294
|
+
<span class="cline-any cline-neutral"> </span>
|
|
295
|
+
<span class="cline-any cline-yes">1x</span>
|
|
296
|
+
<span class="cline-any cline-neutral"> </span>
|
|
297
|
+
<span class="cline-any cline-neutral"> </span>
|
|
298
|
+
<span class="cline-any cline-neutral"> </span>
|
|
299
|
+
<span class="cline-any cline-neutral"> </span>
|
|
154
300
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { Client } from "../Client";
|
|
155
|
-
import { GENERIC_CALCULATION_API_PATH, POST } from "../Constants";
|
|
301
|
+
import { GENERIC_CALCULATION_API_PATH,CALCULATION_TYPES, POST, GET, GENERAL_API_AREA, GENERAL_API_UNITS } from "../Constants";
|
|
156
302
|
import { CalculationRequest } from "../interfaces/Api";
|
|
303
|
+
import { AreaResponse } from "../interfaces/response/AreaResponse";
|
|
304
|
+
import { EmissionResponse } from "../interfaces/response/EmissionResponse";
|
|
305
|
+
import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
|
|
306
|
+
import { TypeResponse } from "../interfaces/response/TypeResponse";
|
|
307
|
+
import { UnitResponse } from "../interfaces/response/UnitResponse";
|
|
157
308
|
import { makeApiRequest } from "../request";
|
|
158
309
|
|
|
159
310
|
|
|
160
311
|
/**
|
|
161
312
|
* Performs emission calculations by making a POST request to the generic calculation API endpoint.
|
|
162
|
-
*
|
|
313
|
+
*
|
|
163
314
|
* @export
|
|
164
315
|
* @param {CalculationRequest} payload - The calculation request data to be sent to the API
|
|
165
|
-
* @return {Promise<
|
|
316
|
+
* @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
|
|
166
317
|
* @throws {Error} May throw an error if the API request fails
|
|
167
|
-
*
|
|
318
|
+
*
|
|
168
319
|
* @example
|
|
169
320
|
* const calculationRequest = {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
321
|
+
"time" : {
|
|
322
|
+
"date": "2025-01-04"
|
|
323
|
+
},
|
|
324
|
+
"location": {
|
|
325
|
+
"country": "usa",
|
|
326
|
+
"stateProvince": "new york"
|
|
327
|
+
},
|
|
328
|
+
"activity": {
|
|
329
|
+
"type":"Waste Combusted - Steel Cans:Default factor",
|
|
330
|
+
"unit": "kg",
|
|
331
|
+
"value": 1223123.121
|
|
332
|
+
},
|
|
333
|
+
"includeDetails": true
|
|
334
|
+
};
|
|
184
335
|
* const result = await calculate(calculationRequest);
|
|
185
336
|
*/
|
|
186
337
|
export async function calculate(
|
|
187
338
|
payload: CalculationRequest
|
|
188
|
-
): Promise<
|
|
339
|
+
): Promise<EmissionResponse | EmissionResponseWithDetails> {
|
|
189
340
|
const client = Client.getInstance();
|
|
190
341
|
const url = client.getDomain() + GENERIC_CALCULATION_API_PATH;
|
|
191
342
|
|
|
192
|
-
return makeApiRequest<
|
|
343
|
+
return makeApiRequest<EmissionResponse | EmissionResponseWithDetails>({
|
|
193
344
|
method: POST,
|
|
194
345
|
url,
|
|
195
346
|
data: payload,
|
|
196
347
|
});
|
|
197
348
|
}
|
|
198
|
-
 
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Retrieves available calculation types by making a GET request to the calculation types API endpoint.
|
|
353
|
+
*
|
|
354
|
+
* @export
|
|
355
|
+
* @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available calculation types
|
|
356
|
+
* @throws {Error} May throw an error if the API request fails
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* const types = await getTypes();
|
|
360
|
+
*/
|
|
361
|
+
export async function getTypes(): Promise<TypeResponse> {
|
|
362
|
+
const client = Client.getInstance();
|
|
363
|
+
const url = client.getDomain() + CALCULATION_TYPES;
|
|
364
|
+
|
|
365
|
+
return makeApiRequest<TypeResponse>({
|
|
366
|
+
method: GET,
|
|
367
|
+
url
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Retrieves information about geographical areas supported by the calculation API.
|
|
373
|
+
*
|
|
374
|
+
* @export
|
|
375
|
+
* @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
|
|
376
|
+
* @throws {Error} May throw an error if the API request fails
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* const areas = await getArea();
|
|
380
|
+
*/
|
|
381
|
+
export async function getArea(): Promise<AreaResponse> {
|
|
382
|
+
const client = Client.getInstance();
|
|
383
|
+
const url = client.getDomain() + GENERAL_API_AREA;
|
|
384
|
+
|
|
385
|
+
return makeApiRequest<AreaResponse>({
|
|
386
|
+
method: GET,
|
|
387
|
+
url
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/**
|
|
392
|
+
* Retrieves available units for a specific calculation type.
|
|
393
|
+
*
|
|
394
|
+
* @export
|
|
395
|
+
* @param {string} type - The calculation type to get units for
|
|
396
|
+
* @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
|
|
397
|
+
* @throws {Error} May throw an error if the API request fails
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* // Get units for the "Natural Gas - Scope 3:AAA" emission calculation type with subtype
|
|
401
|
+
* const units = await getUnits("Natural Gas - Scope 3:AAA");
|
|
402
|
+
|
|
403
|
+
* // Get units for the "HFC-263fb" emission calculation type without subtype
|
|
404
|
+
* const units = await getUnits("HFC-263fb");
|
|
405
|
+
*/
|
|
406
|
+
export async function getUnits(
|
|
407
|
+
type: string
|
|
408
|
+
): Promise<UnitResponse> {
|
|
409
|
+
const client = Client.getInstance();
|
|
410
|
+
const url = client.getDomain() + GENERAL_API_UNITS;
|
|
411
|
+
|
|
412
|
+
return makeApiRequest<UnitResponse>({
|
|
413
|
+
method: GET,
|
|
414
|
+
url,
|
|
415
|
+
params : { type }
|
|
416
|
+
});
|
|
417
|
+
}</pre></td></tr></table></pre>
|
|
199
418
|
|
|
200
419
|
<div class='push'></div><!-- for sticky footer -->
|
|
201
420
|
</div><!-- /wrapper -->
|
|
202
421
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
203
422
|
Code coverage generated by
|
|
204
423
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
205
|
-
at 2025-
|
|
424
|
+
at 2025-12-11T17:06:20.018Z
|
|
206
425
|
</div>
|
|
207
426
|
<script src="../../prettify.js"></script>
|
|
208
427
|
<script>
|