emissions-api-sdk 1.0.1 → 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 (106) hide show
  1. package/dist/api/Calculation.js +4 -4
  2. package/dist/api/Factor.js +7 -7
  3. package/dist/api/FactorSets.js +1 -1
  4. package/dist/api/Fugitive.js +4 -4
  5. package/dist/api/Location.js +4 -4
  6. package/dist/api/Mobile.js +4 -6
  7. package/dist/api/Stationary.js +4 -4
  8. package/dist/api/TransportationAndDistribution.js +5 -5
  9. package/dist/coverage/clover.xml +335 -0
  10. package/dist/coverage/coverage-final.json +19 -0
  11. package/dist/coverage/lcov-report/base.css +224 -0
  12. package/dist/coverage/lcov-report/block-navigation.js +87 -0
  13. package/dist/coverage/lcov-report/favicon.png +0 -0
  14. package/dist/coverage/lcov-report/index.html +161 -0
  15. package/dist/coverage/lcov-report/prettify.css +1 -0
  16. package/dist/coverage/lcov-report/prettify.js +2 -0
  17. package/dist/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  18. package/dist/coverage/lcov-report/sorter.js +210 -0
  19. package/dist/coverage/lcov-report/src/Client.ts.html +838 -0
  20. package/dist/coverage/lcov-report/src/Constants.ts.html +208 -0
  21. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +436 -0
  22. package/dist/coverage/lcov-report/src/api/Factor.ts.html +622 -0
  23. package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +157 -0
  24. package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +436 -0
  25. package/dist/coverage/lcov-report/src/api/Location.ts.html +433 -0
  26. package/dist/coverage/lcov-report/src/api/Mobile.ts.html +448 -0
  27. package/dist/coverage/lcov-report/src/api/Stationary.ts.html +442 -0
  28. package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +436 -0
  29. package/dist/coverage/lcov-report/src/api/index.html +221 -0
  30. package/dist/coverage/lcov-report/src/index.html +161 -0
  31. package/dist/coverage/lcov-report/src/request.ts.html +235 -0
  32. package/dist/coverage/lcov-report/src/utils.ts.html +139 -0
  33. package/dist/coverage/lcov-report/test/index.html +116 -0
  34. package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +142 -0
  35. package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +133 -0
  36. package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +142 -0
  37. package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +139 -0
  38. package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +142 -0
  39. package/dist/coverage/lcov-report/test/mocks/index.html +176 -0
  40. package/dist/coverage/lcov-report/test/testUtils.ts.html +97 -0
  41. package/dist/coverage/lcov.info +558 -0
  42. package/dist/interfaces/response/AreaResponse.js +2 -0
  43. package/dist/interfaces/response/EmissionResponse.js +2 -0
  44. package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
  45. package/dist/interfaces/response/FactorResponse.js +2 -0
  46. package/dist/interfaces/response/FactorSetResponse.js +2 -0
  47. package/dist/interfaces/response/SearchResponse.js +2 -0
  48. package/dist/interfaces/response/TypeResponse.js +2 -0
  49. package/dist/interfaces/response/UnitResponse.js +2 -0
  50. package/dist/types/api/Calculation.d.ts +13 -8
  51. package/dist/types/api/Factor.d.ts +18 -13
  52. package/dist/types/api/FactorSets.d.ts +3 -2
  53. package/dist/types/api/Fugitive.d.ts +13 -8
  54. package/dist/types/api/Location.d.ts +13 -8
  55. package/dist/types/api/Mobile.d.ts +13 -10
  56. package/dist/types/api/Stationary.d.ts +13 -8
  57. package/dist/types/api/TransportationAndDistribution.d.ts +14 -9
  58. package/dist/types/index.d.ts +8 -0
  59. package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
  60. package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
  61. package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
  62. package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
  63. package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
  64. package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
  65. package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
  66. package/dist/types/interfaces/response/UnitResponse.d.ts +7 -0
  67. package/docs/_sources/index.rst.txt +1 -0
  68. package/docs/_sources/troubleshooting.rst.txt +486 -0
  69. package/docs/_static/basic.css +8 -0
  70. package/docs/_static/pygments.css +146 -164
  71. package/docs/_static/searchtools.js +5 -8
  72. package/docs/_static/styles/furo.css +1 -1
  73. package/docs/_static/styles/furo.css.map +1 -1
  74. package/docs/authentication.html +29 -19
  75. package/docs/client.html +29 -19
  76. package/docs/genindex.html +29 -19
  77. package/docs/getting_started.html +29 -19
  78. package/docs/index.html +42 -19
  79. package/docs/objects.inv +0 -0
  80. package/docs/reference.html +69 -53
  81. package/docs/sdk.html +29 -19
  82. package/docs/search.html +29 -19
  83. package/docs/searchindex.js +1 -1
  84. package/docs/troubleshooting.html +786 -0
  85. package/package.json +1 -1
  86. package/sphinx-build/requirements.txt +5 -0
  87. package/sphinx-build/source/index.rst +1 -0
  88. package/sphinx-build/source/troubleshooting.rst +486 -0
  89. package/src/api/Calculation.ts +19 -14
  90. package/src/api/Factor.ts +27 -22
  91. package/src/api/FactorSets.ts +4 -3
  92. package/src/api/Fugitive.ts +19 -14
  93. package/src/api/Location.ts +20 -15
  94. package/src/api/Mobile.ts +19 -16
  95. package/src/api/Stationary.ts +19 -14
  96. package/src/api/TransportationAndDistribution.ts +21 -16
  97. package/src/index.ts +33 -1
  98. package/src/interfaces/response/AreaResponse.ts +25 -0
  99. package/src/interfaces/response/EmissionResponse.ts +44 -0
  100. package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
  101. package/src/interfaces/response/FactorResponse.ts +78 -0
  102. package/src/interfaces/response/FactorSetResponse.ts +52 -0
  103. package/src/interfaces/response/SearchResponse.ts +52 -0
  104. package/src/interfaces/response/TypeResponse.ts +7 -0
  105. package/src/interfaces/response/UnitResponse.ts +7 -0
  106. package/test/apiTest.test.ts +1 -1
@@ -12,7 +12,7 @@ const request_1 = require("../request");
12
12
  *
13
13
  * @export
14
14
  * @param {CalculationRequest} payload - The calculation request data to be sent to the API
15
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -46,7 +46,7 @@ async function calculate(payload) {
46
46
  * Retrieves available calculation types by making a GET request to the calculation types API endpoint.
47
47
  *
48
48
  * @export
49
- * @return {Promise<string>} A promise that resolves to a string containing the available calculation types
49
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available calculation types
50
50
  * @throws {Error} May throw an error if the API request fails
51
51
  *
52
52
  * @example
@@ -64,7 +64,7 @@ async function getTypes() {
64
64
  * Retrieves information about geographical areas supported by the calculation API.
65
65
  *
66
66
  * @export
67
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
67
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
68
68
  * @throws {Error} May throw an error if the API request fails
69
69
  *
70
70
  * @example
@@ -83,7 +83,7 @@ async function getArea() {
83
83
  *
84
84
  * @export
85
85
  * @param {string} type - The calculation type to get units for
86
- * @return {Promise<string>} A promise that resolves to a string containing the available units
86
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
87
87
  * @throws {Error} May throw an error if the API request fails
88
88
  *
89
89
  * @example
@@ -14,7 +14,7 @@ const request_1 = require("../request");
14
14
  *
15
15
  * @export
16
16
  * @param {FactorRequest} payload - The factor request data to be sent to the API
17
- * @return {Promise<string>} A promise that resolves to the factor string returned by the API
17
+ * @return {Promise<FactorResponse>} A promise that resolves to the FactorResponse returned by the API
18
18
  * @throws {Error} May throw an error if the API request fails
19
19
  *
20
20
  * @example
@@ -55,7 +55,7 @@ async function retrieveFactor(payload) {
55
55
  *
56
56
  * @export
57
57
  * @param {SearchRequest} payload - The search request data to be sent to the API
58
- * @return {Promise<string>} A promise that resolves to the search results string returned by the API
58
+ * @return {Promise<SearchResponse>} A promise that resolves to the search results returned by the API
59
59
  * @throws {Error} May throw an error if the API request fails
60
60
  *
61
61
  * @example
@@ -84,7 +84,7 @@ async function search(payload) {
84
84
  * Retrieves available emission factor types by making a GET request to the API endpoint.
85
85
  *
86
86
  * @export
87
- * @return {Promise<string>} A promise that resolves to a string containing the available emission factor types
87
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available emission factor types
88
88
  * @throws {Error} May throw an error if the API request fails
89
89
  *
90
90
  * @example
@@ -102,11 +102,11 @@ async function getTypes() {
102
102
  * Retrieves information about geographical areas supported by the factor search API.
103
103
  *
104
104
  * @export
105
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
105
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
106
106
  * @throws {Error} May throw an error if the API request fails
107
107
  *
108
108
  * @example
109
- * const areas = await getArea();
109
+ * const areas = await getSearchArea();
110
110
  */
111
111
  async function getSearchArea() {
112
112
  const client = Client_1.Client.getInstance();
@@ -120,7 +120,7 @@ async function getSearchArea() {
120
120
  * Retrieves information about geographical areas supported by the factor API.
121
121
  *
122
122
  * @export
123
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
123
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
124
124
  * @throws {Error} May throw an error if the API request fails
125
125
  *
126
126
  * @example
@@ -139,7 +139,7 @@ async function getArea() {
139
139
  *
140
140
  * @export
141
141
  * @param {string} type - The emission factor type to get units for (e.g., "Natural Gas - Scope 3:AAA")
142
- * @return {Promise<string>} A promise that resolves to a string containing the available units
142
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
143
143
  * @throws {Error} May throw an error if the API request fails
144
144
  *
145
145
  * @example
@@ -8,7 +8,7 @@ const request_1 = require("../request");
8
8
  * Retrieves factor sets by making a GET request to the factor set API endpoint.
9
9
  *
10
10
  * @export
11
- * @return {Promise<string>} A promise that resolves to the factor sets string returned by the API
11
+ * @return {Promise<FactorSetResponse>} A promise that resolves to the FactorSetResponse returned by the API
12
12
  * @throws {Error} May throw an error if the API request fails
13
13
  *
14
14
  * @example
@@ -12,7 +12,7 @@ const request_1 = require("../request");
12
12
  *
13
13
  * @export
14
14
  * @param {CommonRequest} payload - The request data to be sent to the API
15
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -45,7 +45,7 @@ async function calculate(payload) {
45
45
  * Retrieves available fugitive emission calculation types by making a GET request to the API endpoint.
46
46
  *
47
47
  * @export
48
- * @return {Promise<string>} A promise that resolves to a string containing the available fugitive emission types
48
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available fugitive emission types
49
49
  * @throws {Error} May throw an error if the API request fails
50
50
  *
51
51
  * @example
@@ -63,7 +63,7 @@ async function getTypes() {
63
63
  * Retrieves information about geographical areas supported by the fugitive emissions API.
64
64
  *
65
65
  * @export
66
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
66
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
67
67
  * @throws {Error} May throw an error if the API request fails
68
68
  *
69
69
  * @example
@@ -82,7 +82,7 @@ async function getArea() {
82
82
  *
83
83
  * @export
84
84
  * @param {string} type - The fugitive emission type to get units for (e.g., "R134A")
85
- * @return {Promise<string>} A promise that resolves to a string containing the available units
85
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
86
86
  * @throws {Error} May throw an error if the API request fails
87
87
  *
88
88
  * @example
@@ -12,7 +12,7 @@ const request_1 = require("../request");
12
12
  *
13
13
  * @export
14
14
  * @param {LocationRequest} payload - The location request data to be sent to the API
15
- * @return {Promise<string>} A promise that resolves to the purchased energy emission result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -46,7 +46,7 @@ async function calculate(payload) {
46
46
  * Retrieves available location-based calculation types by making a GET request to the location types API endpoint.
47
47
  *
48
48
  * @export
49
- * @return {Promise<string>} A promise that resolves to a string containing the available location-based calculation types
49
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available location-based calculation types
50
50
  * @throws {Error} May throw an error if the API request fails
51
51
  *
52
52
  * @example
@@ -65,7 +65,7 @@ async function getTypes() {
65
65
  * Retrieves information about geographical areas supported by the location-based calculation API.
66
66
  *
67
67
  * @export
68
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
68
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
69
69
  * @throws {Error} May throw an error if the API request fails
70
70
  *
71
71
  * @example
@@ -84,7 +84,7 @@ async function getArea() {
84
84
  *
85
85
  * @export
86
86
  * @param {string} type - The location-based calculation type to get units for (e.g., "electricity")
87
- * @return {Promise<string>} A promise that resolves to a string containing the available units
87
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
88
88
  * @throws {Error} May throw an error if the API request fails
89
89
  *
90
90
  * @example
@@ -12,7 +12,7 @@ const Client_1 = require("../Client");
12
12
  *
13
13
  * @export
14
14
  * @param {CommonRequest} payload - The request data to be sent to the mobile API
15
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -46,14 +46,12 @@ async function calculate(payload) {
46
46
  * Retrieves available mobile emission calculation types by making a GET request to the API endpoint.
47
47
  *
48
48
  * @export
49
- * @return {Promise<string>} A promise that resolves to a string containing the available mobile emission types
49
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available mobile emission types
50
50
  * @throws {Error} May throw an error if the API request fails
51
51
  *
52
52
  * @example
53
53
  * // Get all available mobile emission types
54
54
  * const types = await getTypes();
55
- * const typesData = JSON.parse(types);
56
- * console.log("Available mobile emission types:", typesData);
57
55
  */
58
56
  async function getTypes() {
59
57
  const client = Client_1.Client.getInstance();
@@ -67,7 +65,7 @@ async function getTypes() {
67
65
  * Retrieves information about geographical areas supported by the mobile emissions API.
68
66
  *
69
67
  * @export
70
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
68
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
71
69
  * @throws {Error} May throw an error if the API request fails
72
70
  *
73
71
  * @example
@@ -86,7 +84,7 @@ async function getArea() {
86
84
  *
87
85
  * @export
88
86
  * @param {string} type - The mobile emission type to get units for (e.g., "Diesel Fuel")
89
- * @return {Promise<string>} A promise that resolves to a string containing the available units
87
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
90
88
  * @throws {Error} May throw an error if the API request fails
91
89
  *
92
90
  * @example
@@ -12,7 +12,7 @@ const request_1 = require("../request");
12
12
  *
13
13
  * @export
14
14
  * @param {CommonRequest} payload - The request data to be sent to the stationary API
15
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -46,7 +46,7 @@ async function calculate(payload) {
46
46
  * Retrieves available stationary emission calculation types by making a GET request to the API endpoint.
47
47
  *
48
48
  * @export
49
- * @return {Promise<string>} A promise that resolves to a string containing the available stationary emission types
49
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available stationary emission types
50
50
  * @throws {Error} May throw an error if the API request fails
51
51
  *
52
52
  * @example
@@ -64,7 +64,7 @@ async function getTypes() {
64
64
  * Retrieves information about geographical areas supported by the stationary emissions API.
65
65
  *
66
66
  * @export
67
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
67
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
68
68
  * @throws {Error} May throw an error if the API request fails
69
69
  *
70
70
  * @example
@@ -83,7 +83,7 @@ async function getArea() {
83
83
  *
84
84
  * @export
85
85
  * @param {string} type - The stationary emission type to get units for (e.g., "Coal - Lignite")
86
- * @return {Promise<string>} A promise that resolves to a string containing the available units
86
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
87
87
  * @throws {Error} May throw an error if the API request fails
88
88
  *
89
89
  * @example
@@ -8,11 +8,11 @@ const Client_1 = require("../Client");
8
8
  const Constants_1 = require("../Constants");
9
9
  const request_1 = require("../request");
10
10
  /**
11
- * Performs Scope 2 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
11
+ * Performs Scope 3 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
12
12
  *
13
13
  * @export
14
14
  * @param {CalculationRequest} payload - The calculation request data for transportation and distribution operations
15
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
15
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
16
16
  * @throws {Error} May throw an error if the API request fails
17
17
  *
18
18
  * @example
@@ -45,7 +45,7 @@ async function calculate(payload) {
45
45
  * Retrieves available transportation and distribution calculation types by making a GET request to the API endpoint.
46
46
  *
47
47
  * @export
48
- * @return {Promise<string>} A promise that resolves to a string containing the available transportation and distribution calculation types
48
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available transportation and distribution calculation types
49
49
  * @throws {Error} May throw an error if the API request fails
50
50
  *
51
51
  * @example
@@ -63,7 +63,7 @@ async function getTypes() {
63
63
  * Retrieves information about geographical areas supported by the transportation and distribution API.
64
64
  *
65
65
  * @export
66
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
66
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
67
67
  * @throws {Error} May throw an error if the API request fails
68
68
  *
69
69
  * @example
@@ -82,7 +82,7 @@ async function getArea() {
82
82
  *
83
83
  * @export
84
84
  * @param {string} type - The transportation and distribution calculation type to get units for (e.g., "Freight - Cargo Ship")
85
- * @return {Promise<string>} A promise that resolves to a string containing the available units
85
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
86
86
  * @throws {Error} May throw an error if the API request fails
87
87
  *
88
88
  * @example