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
@@ -1,68 +0,0 @@
1
- import { FactorRequest, SearchRequest } from "../interfaces/Api";
2
- /**
3
- * Retrieves a factor details by making a POST request to the factor API endpoint.
4
- *
5
- * @export
6
- * @param {FactorRequest} payload - The factor request data to be sent to the API
7
- * @return {Promise<string>} A promise that resolves to the factor string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const factorRequest = {
12
-
13
- "activity": {
14
- "factorId": 12345
15
- }
16
- };
17
-
18
- or
19
-
20
- const factorRequest = {
21
- "time" : {
22
- "date": "2025-01-04"
23
- },
24
- "location": {
25
- "country": "usa",
26
- "stateProvince": "new york"
27
- },
28
- "activity": {
29
- "type":"natural gas"
30
- },
31
- "includeDetails": true
32
- };
33
- * const factor = await retrieveFactor(factorRequest);
34
- */
35
- export declare function retrieveFactor(payload: FactorRequest): Promise<string>;
36
- /**
37
- * Retrieves factor sets by making a GET request to the factor set API endpoint.
38
- *
39
- * @export
40
- * @return {Promise<string>} A promise that resolves to the factor sets string returned by the API
41
- * @throws {Error} May throw an error if the API request fails
42
- *
43
- * @example
44
- * const factorSets = await getFactorSets();
45
- */
46
- export declare function getFactorSets(): Promise<string>;
47
- /**
48
- * Performs a search operation by making a POST request to the search API endpoint.
49
- *
50
- * @export
51
- * @param {SearchRequest} payload - The search request data to be sent to the API
52
- * @return {Promise<string>} A promise that resolves to the search results string returned by the API
53
- * @throws {Error} May throw an error if the API request fails
54
- *
55
- * @example
56
- * const searchRequest = {
57
- "time":{
58
- "date": "2020-06-10"
59
- },
60
- "activity": {
61
- "search" : "travel"},
62
- "location": {
63
- "country": "USA"
64
- }
65
- };
66
- * const results = await Search(searchRequest);
67
- */
68
- export declare function Search(payload: SearchRequest): Promise<string>;
@@ -1,27 +0,0 @@
1
- import { CommonRequest } from "../interfaces/Api";
2
- /**
3
- * Performs scope 1 fugitve emission calculations by making a POST request to the fugitive API endpoint.
4
- *
5
- * @export
6
- * @param {CommonRequest} payload - The request data to be sent to the API
7
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const request = {
12
- "time": {
13
- "date": "2025-01-04"
14
- },
15
- "location": {
16
- "country": "usa"
17
- },
18
- "activity": {
19
- "type": "R134A",
20
- "value": 150,
21
- "unit": "kg"
22
- },
23
- "includeDetails": false
24
- };
25
- * const result = await calculate(request);
26
- */
27
- export declare function calculate(payload: CommonRequest): Promise<string>;
@@ -1,28 +0,0 @@
1
- import { GenericCalculationRequest } from "../interfaces/Api";
2
- /**
3
- * Performs emission calculations by making a POST request to the generic calculation API endpoint.
4
- *
5
- * @export
6
- * @param {GenericCalculationRequest} payload - The calculation request data to be sent to the API
7
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const calculationRequest = {
12
- "time" : {
13
- "date": "2025-01-04"
14
- },
15
- "location": {
16
- "country": "usa",
17
- "stateProvince": "new york"
18
- },
19
- "activity": {
20
- "type":"Waste Combusted - Steel Cans:Default factor",
21
- "unit": "kg",
22
- "value": 1223123.121
23
- },
24
- "includeDetails": true
25
- };
26
- * const result = await calculate(calculationRequest);
27
- */
28
- export declare function calculate(payload: GenericCalculationRequest): Promise<string>;
@@ -1,28 +0,0 @@
1
- import { LocationRequest } from "../interfaces/Api";
2
- /**
3
- * Performs scope 2 purchased energy Emission calculations by making a POST request to the location API endpoint.
4
- *
5
- * @export
6
- * @param {LocationRequest} payload - The location request data to be sent to the API
7
- * @return {Promise<string>} A promise that resolves to the purchased energy emission result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const calculationRequest = {
12
- "time" : {
13
- "date": "2025-01-04"
14
- },
15
- "location": {
16
- "country": "usa",
17
- "stateProvince": "new york"
18
- },
19
- "activity": {
20
- "type":"electricity",
21
- "unit": "kwh",
22
- "value": 14123143
23
- },
24
- "includeDetails": true
25
- };
26
- * const result = await calculate(calculationRequest);
27
- */
28
- export declare function calculate(payload: LocationRequest): Promise<string>;
@@ -1,28 +0,0 @@
1
- import { CommonRequest } from "../interfaces/Api";
2
- /**
3
- * Performs Scope 1 mobile emissions related calculations by making a POST request to the mobile API endpoint.
4
- *
5
- * @export
6
- * @param {CommonRequest} payload - The request data to be sent to the mobile API
7
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const request = {
12
- "time": {
13
- "date": "2022-01-01"
14
- },
15
- "location": {
16
- "country": "USA",
17
- "stateProvince": "new york"
18
- },
19
- "activity": {
20
- "type": "Diesel Fuel",
21
- "value": 1500000,
22
- "unit": "l"
23
- },
24
- "includeDetails": false
25
- };
26
- * const result = await calculate(request);
27
- */
28
- export declare function calculate(payload: CommonRequest): Promise<string>;
@@ -1,28 +0,0 @@
1
- import { CommonRequest } from "../interfaces/Api";
2
- /**
3
- * Performs Scope 1 stationary calculations by making a POST request to the stationary API endpoint.
4
- *
5
- * @export
6
- * @param {CommonRequest} payload - The request data to be sent to the stationary API
7
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const request = {
12
- "time" : {
13
- "date": "2025-01-04"
14
- },
15
- "location": {
16
- "country": "usa",
17
- "stateProvince": "new york"
18
- },
19
- "activity": {
20
- "type":"Coal - Lignite",
21
- "unit": "KJ",
22
- "value": 3
23
- },
24
- "includeDetails": true
25
- };
26
- * const result = await calculate(request);
27
- */
28
- export declare function calculate(payload: CommonRequest): Promise<string>;
@@ -1,27 +0,0 @@
1
- import { GenericCalculationRequest } from "../interfaces/Api";
2
- /**
3
- * Performs Scope 2 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
4
- *
5
- * @export
6
- * @param {GenericCalculationRequest} payload - The calculation request data for transportation and distribution operations
7
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
8
- * @throws {Error} May throw an error if the API request fails
9
- *
10
- * @example
11
- * const request = {
12
- "time" : {
13
- "date": "2025-01-04"
14
- },
15
- "location": {
16
- "country": "usa"
17
- },
18
- "activity": {
19
- "type": "Freight - Cargo Ship - Bulk Carrier - 0-9999 dwt",
20
- "unit": ["t","km"],
21
- "value": [1.0,1.0]
22
- },
23
- "includeDetails": true
24
- };
25
- * const result = await calculate(request);
26
- */
27
- export declare function calculate(payload: GenericCalculationRequest): Promise<string>;