emissions-api-sdk 1.0.4 → 1.0.6

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 (93) hide show
  1. package/README.md +19 -26
  2. package/dist/Constants.js +6 -23
  3. package/dist/api/Calculation.js +0 -63
  4. package/dist/api/EconomicActivity.js +40 -0
  5. package/dist/api/Factor.js +0 -82
  6. package/dist/api/Fugitive.js +0 -63
  7. package/dist/api/Location.js +0 -61
  8. package/dist/api/Metadata.js +155 -0
  9. package/dist/api/Mobile.js +0 -64
  10. package/dist/api/RealEstate.js +40 -0
  11. package/dist/api/Stationary.js +0 -63
  12. package/dist/api/TransportationAndDistribution.js +0 -63
  13. package/dist/coverage/clover.xml +144 -199
  14. package/dist/coverage/coverage-final.json +14 -11
  15. package/dist/coverage/lcov-report/index.html +20 -20
  16. package/dist/coverage/lcov-report/src/Client.ts.html +28 -28
  17. package/dist/coverage/lcov-report/src/Constants.ts.html +31 -88
  18. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +7 -217
  19. package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +220 -0
  20. package/dist/coverage/lcov-report/src/api/Factor.ts.html +6 -285
  21. package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
  22. package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +7 -223
  23. package/dist/coverage/lcov-report/src/api/Location.ts.html +6 -222
  24. package/dist/coverage/lcov-report/src/api/Metadata.ts.html +604 -0
  25. package/dist/coverage/lcov-report/src/api/Mobile.ts.html +6 -231
  26. package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +217 -0
  27. package/dist/coverage/lcov-report/src/api/Stationary.ts.html +6 -225
  28. package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +7 -223
  29. package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
  30. package/dist/coverage/lcov-report/src/api/index.html +72 -27
  31. package/dist/coverage/lcov-report/src/index.html +7 -7
  32. package/dist/coverage/lcov-report/src/request.ts.html +5 -5
  33. package/dist/coverage/lcov-report/src/utils.ts.html +6 -6
  34. package/dist/coverage/lcov-report/test/index.html +1 -1
  35. package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
  36. package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
  37. package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
  38. package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
  39. package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
  40. package/dist/coverage/lcov-report/test/mocks/index.html +1 -1
  41. package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
  42. package/dist/coverage/lcov.info +241 -294
  43. package/dist/index.js +4 -1
  44. package/dist/types/Constants.d.ts +5 -22
  45. package/dist/types/api/Calculation.d.ts +0 -41
  46. package/dist/types/api/EconomicActivity.d.ts +29 -0
  47. package/dist/types/api/Factor.d.ts +0 -52
  48. package/dist/types/api/Fugitive.d.ts +0 -41
  49. package/dist/types/api/Location.d.ts +0 -39
  50. package/dist/types/api/Metadata.d.ts +99 -0
  51. package/dist/types/api/Mobile.d.ts +0 -42
  52. package/dist/types/api/RealEstate.d.ts +29 -0
  53. package/dist/types/api/Stationary.d.ts +0 -41
  54. package/dist/types/api/TransportationAndDistribution.d.ts +0 -41
  55. package/dist/types/index.d.ts +3 -0
  56. package/dist/types/interfaces/response/FactorResponse.d.ts +0 -4
  57. package/docs/_sources/index.rst.txt +8 -6
  58. package/docs/_sources/reference.rst.txt +17 -37
  59. package/docs/_static/basic.css +8 -0
  60. package/docs/_static/pygments.css +146 -164
  61. package/docs/_static/searchtools.js +5 -8
  62. package/docs/_static/styles/furo.css +1 -1
  63. package/docs/_static/styles/furo.css.map +1 -1
  64. package/docs/authentication.html +28 -19
  65. package/docs/client.html +28 -19
  66. package/docs/genindex.html +56 -71
  67. package/docs/getting_started.html +28 -19
  68. package/docs/index.html +31 -20
  69. package/docs/objects.inv +0 -0
  70. package/docs/reference.html +151 -357
  71. package/docs/sdk.html +28 -19
  72. package/docs/search.html +28 -19
  73. package/docs/searchindex.js +1 -1
  74. package/docs/troubleshooting.html +28 -19
  75. package/package.json +7 -2
  76. package/sphinx-build/source/index.rst +8 -6
  77. package/sphinx-build/source/reference.rst +17 -37
  78. package/src/Constants.ts +6 -25
  79. package/src/api/Calculation.ts +1 -72
  80. package/src/api/EconomicActivity.ts +45 -0
  81. package/src/api/Factor.ts +1 -94
  82. package/src/api/Fugitive.ts +1 -74
  83. package/src/api/Location.ts +1 -73
  84. package/src/api/Metadata.ts +174 -0
  85. package/src/api/Mobile.ts +1 -76
  86. package/src/api/RealEstate.ts +45 -0
  87. package/src/api/Stationary.ts +1 -74
  88. package/src/api/TransportationAndDistribution.ts +1 -74
  89. package/src/index.ts +3 -0
  90. package/src/interfaces/response/FactorResponse.ts +0 -7
  91. package/test/apiTest.test.ts +19 -162
  92. package/test/metadata.test.ts +224 -0
  93. package/test/request.test.ts +0 -1
@@ -27,61 +27,41 @@ API
27
27
 
28
28
  .. js:autofunction:: TransportationAndDistribution.calculate
29
29
 
30
- Metadata APIs
31
- ===========
30
+ .. js:autofunction:: RealEstate.calculate
32
31
 
33
- getTypes
34
- --------
32
+ .. js:autofunction:: EconomicActivity.calculate
35
33
 
36
- .. js:autofunction:: Factor.getTypes
37
34
 
38
- .. js:autofunction:: Calculation.getTypes
35
+ Global Metadata API
36
+ ====================
39
37
 
40
- .. js:autofunction:: Location.getTypes
38
+ The global Metadata API provides a unified way to query metadata across different endpoints without calling endpoint-specific methods.
41
39
 
42
- .. js:autofunction:: Mobile.getTypes
40
+ - **getTypes/postTypes** and **getArea/postArea**: Accept an optional ``endpoint`` parameter to query metadata for specific endpoints
41
+ - **getUnits/postUnits**: Accept an optional ``type`` parameter to query units for specific emission types
43
42
 
44
- .. js:autofunction:: Stationary.getTypes
43
+ **Supported endpoints** (for getTypes/postTypes and getArea/postArea): ``calculation``, ``location``, ``stationary``, ``mobile``, ``fugitive``, ``factor``, ``search``, ``transportation-and-distribution``, ``economic-activity``, ``real-estate``
45
44
 
46
- .. js:autofunction:: TransportationAndDistribution.getTypes
45
+ getTypes
46
+ --------
47
47
 
48
- .. js:autofunction:: Fugitive.getTypes
48
+ .. js:autofunction:: Metadata.getTypes
49
+
50
+ .. js:autofunction:: Metadata.postTypes
49
51
 
50
52
  getArea
51
53
  -------
52
54
 
53
- .. js:autofunction:: Factor.getArea
54
-
55
- .. js:autofunction:: Factor.getSearchArea
56
-
57
- .. js:autofunction:: Calculation.getArea
58
-
59
- .. js:autofunction:: Location.getArea
55
+ .. js:autofunction:: Metadata.getArea
60
56
 
61
- .. js:autofunction:: Mobile.getArea
62
-
63
- .. js:autofunction:: Stationary.getArea
64
-
65
- .. js:autofunction:: TransportationAndDistribution.getArea
66
-
67
- .. js:autofunction:: Fugitive.getArea
57
+ .. js:autofunction:: Metadata.postArea
68
58
 
69
59
  getUnits
70
60
  --------
71
61
 
72
- .. js:autofunction:: Factor.getUnits
73
-
74
- .. js:autofunction:: Calculation.getUnits
75
-
76
- .. js:autofunction:: Location.getUnits
77
-
78
- .. js:autofunction:: Mobile.getUnits
79
-
80
- .. js:autofunction:: Stationary.getUnits
81
-
82
- .. js:autofunction:: TransportationAndDistribution.getUnits
62
+ .. js:autofunction:: Metadata.getUnits
83
63
 
84
- .. js:autofunction:: Fugitive.getUnits
64
+ .. js:autofunction:: Metadata.postUnits
85
65
 
86
66
 
87
67
  Usage API
package/src/Constants.ts CHANGED
@@ -9,34 +9,15 @@ export const TRANSPORTATION_AND_DISTRIBUTION_API_PATH = "/v3/carbon/transportati
9
9
  export const FACTOR_API_PATH = "/v3/carbon/factor";
10
10
  export const FACTOR_SET_API_PATH = "/v3/carbon/factorset";
11
11
  export const SEARCH_API_PATH = "/v3/carbon/factor/search";
12
-
13
- export const CALCULATION_TYPES = "/v3/carbon/calculation/types";
14
- export const LOCATION_TYPES = "/v3/carbon/location/types";
15
- export const FUGITIVE_API_TYPES = "/v3/carbon/fugitive/types";
16
- export const MOBILE_API_TYPES = "/v3/carbon/mobile/types";
17
- export const STATIONARY_API_TYPES = "/v3/carbon/stationary/types";
18
- export const FACTOR_API_TYPES = "/v3/carbon/factor/types";
19
- export const TRANSPORTATION_AND_DISTRIBUTION_API_TYPES = "/v3/carbon/transportation-and-distribution/types";
20
-
21
- export const FUGITIVE_API_AREA = "/v3/carbon/fugitive/area";
22
- export const GENERAL_API_AREA = "/v3/carbon/calculation/area";
23
- export const LOCATION_API_AREA = "/v3/carbon/location/area";
24
- export const MOBILE_API_AREA = "/v3/carbon/mobile/area";
25
- export const STATIONARY_API_AREA = "/v3/carbon/stationary/area";
26
- export const TRANSPORTATION_AND_DISTRIBUTION_API_AREA = "/v3/carbon/transportation-and-distribution/area";
27
- export const SEARCH_API_AREA = "/v3/carbon/factor/search/area";
28
- export const FACTOR_API_AREA = "/v3/carbon/factor/area";
29
-
30
- export const FUGITIVE_API_UNITS = "/v3/carbon/fugitive/units";
31
- export const LOCATION_API_UNITS = "/v3/carbon/location/units";
32
- export const MOBILE_API_UNITS = "/v3/carbon/mobile/units";
33
- export const STATIONARY_API_UNITS = "/v3/carbon/stationary/units";
34
- export const GENERAL_API_UNITS = "/v3/carbon/calculation/units";
35
- export const FACTOR_API_UNITS = "/v3/carbon/factor/units";
36
- export const TRANSPORTATION_AND_DISTRIBUTION_API_UNITS = "/v3/carbon/transportation-and-distribution/units";
12
+ export const ECONOMIC_ACTIVITY_API_PATH = "/v3/carbon/economic-activity";
13
+ export const REAL_ESTATE_API_PATH = "/v3/carbon/real-estate";
37
14
 
38
15
  export const USAGE_API = "/v3/carbon/usage";
39
16
 
17
+ export const METADATA_TYPES_ENDPOINT = "/v3/carbon/metadata/types";
18
+ export const METADATA_AREA_ENDPOINT = "/v3/carbon/metadata/area";
19
+ export const METADATA_UNITS_ENDPOINT = "/v3/carbon/metadata/units";
20
+
40
21
  export const GET = "GET";
41
22
  export const POST = "POST";
42
23
  export const CLIENT_SOURCE_HEADER = "X-Client-Source";
@@ -1,11 +1,8 @@
1
1
  import { Client } from "../Client";
2
- import { GENERIC_CALCULATION_API_PATH,CALCULATION_TYPES, POST, GET, GENERAL_API_AREA, GENERAL_API_UNITS } from "../Constants";
2
+ import { GENERIC_CALCULATION_API_PATH, POST } from "../Constants";
3
3
  import { CalculationRequest } from "../interfaces/Api";
4
- import { AreaResponse } from "../interfaces/response/AreaResponse";
5
4
  import { EmissionResponse } from "../interfaces/response/EmissionResponse";
6
5
  import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
7
- import { TypeResponse } from "../interfaces/response/TypeResponse";
8
- import { UnitResponse } from "../interfaces/response/UnitResponse";
9
6
  import { makeApiRequest } from "../request";
10
7
 
11
8
 
@@ -48,71 +45,3 @@ export async function calculate(
48
45
  });
49
46
  }
50
47
 
51
-
52
- /**
53
- * Retrieves available calculation types by making a GET request to the calculation types API endpoint.
54
- *
55
- * @export
56
- * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available calculation types
57
- * @throws {Error} May throw an error if the API request fails
58
- *
59
- * @example
60
- * const types = await getTypes();
61
- */
62
- export async function getTypes(): Promise<TypeResponse> {
63
- const client = Client.getInstance();
64
- const url = client.getDomain() + CALCULATION_TYPES;
65
-
66
- return makeApiRequest<TypeResponse>({
67
- method: GET,
68
- url
69
- });
70
- }
71
-
72
- /**
73
- * Retrieves information about geographical areas supported by the calculation API.
74
- *
75
- * @export
76
- * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
77
- * @throws {Error} May throw an error if the API request fails
78
- *
79
- * @example
80
- * const areas = await getArea();
81
- */
82
- export async function getArea(): Promise<AreaResponse> {
83
- const client = Client.getInstance();
84
- const url = client.getDomain() + GENERAL_API_AREA;
85
-
86
- return makeApiRequest<AreaResponse>({
87
- method: GET,
88
- url
89
- });
90
- }
91
-
92
- /**
93
- * Retrieves available units for a specific calculation type.
94
- *
95
- * @export
96
- * @param {string} type - The calculation type to get units for
97
- * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
98
- * @throws {Error} May throw an error if the API request fails
99
- *
100
- * @example
101
- * // Get units for the "Natural Gas - Scope 3:AAA" emission calculation type with subtype
102
- * const units = await getUnits("Natural Gas - Scope 3:AAA");
103
-
104
- * // Get units for the "HFC-263fb" emission calculation type without subtype
105
- * const units = await getUnits("HFC-263fb");
106
- */
107
- export async function getUnits(
108
- type: string
109
- ): Promise<UnitResponse> {
110
- const client = Client.getInstance();
111
- const url = client.getDomain() + GENERAL_API_UNITS;
112
-
113
- return makeApiRequest<UnitResponse>({
114
- method: GET,
115
- url,
116
- params : { type }
117
- });
118
- }
@@ -0,0 +1,45 @@
1
+ import { Client } from "../Client";
2
+ import { ECONOMIC_ACTIVITY_API_PATH, POST } from "../Constants";
3
+ import { CommonRequest } from "../interfaces/Api";
4
+ import { EmissionResponse } from "../interfaces/response/EmissionResponse";
5
+ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
6
+ import { makeApiRequest } from "../request";
7
+
8
+ /**
9
+ * Performs scope 3 Spend based emission calculations by making a POST request to the economic activity API endpoint.
10
+ *
11
+ * @export
12
+ * @param {CommonRequest} payload - The request data to be sent to the API
13
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
14
+ * @throws {Error} May throw an error if the API request fails
15
+ *
16
+ * @example
17
+ * const request = {
18
+ "time": {
19
+ "date": "2025-01-04"
20
+ },
21
+ "location": {
22
+ "country": "usa"
23
+ },
24
+ "activity": {
25
+ "type": "accomodation",
26
+ "value": 1500.12,
27
+ "unit": "usd"
28
+ },
29
+ "includeDetails": false
30
+ };
31
+ * const result = await calculate(request);
32
+ */
33
+
34
+ export async function calculate(
35
+ payload: CommonRequest
36
+ ): Promise<EmissionResponse | EmissionResponseWithDetails> {
37
+ const client = Client.getInstance();
38
+ const url = client.getDomain() + ECONOMIC_ACTIVITY_API_PATH;
39
+
40
+ return makeApiRequest<EmissionResponse | EmissionResponseWithDetails>({
41
+ method: POST,
42
+ url,
43
+ data: payload,
44
+ });
45
+ }
package/src/api/Factor.ts CHANGED
@@ -1,11 +1,8 @@
1
1
  import { Client } from "../Client";
2
- import { FACTOR_API_AREA, FACTOR_API_PATH, FACTOR_API_TYPES, FACTOR_API_UNITS, GET, POST, SEARCH_API_AREA, SEARCH_API_PATH } from "../Constants";
2
+ import { FACTOR_API_PATH, POST, SEARCH_API_PATH } from "../Constants";
3
3
  import { FactorRequest, SearchRequest } from "../interfaces/Api";
4
- import { AreaResponse } from "../interfaces/response/AreaResponse";
5
4
  import { FactorResponse } from "../interfaces/response/FactorResponse";
6
5
  import { SearchResponse } from "../interfaces/response/SearchResponse";
7
- import { TypeResponse } from "../interfaces/response/TypeResponse";
8
- import { UnitResponse } from "../interfaces/response/UnitResponse";
9
6
  import { makeApiRequest } from "../request";
10
7
 
11
8
  /**
@@ -87,94 +84,4 @@ export async function search(
87
84
  url,
88
85
  data: payload,
89
86
  });
90
- }
91
-
92
- /**
93
- * Retrieves available emission factor types by making a GET request to the API endpoint.
94
- *
95
- * @export
96
- * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available emission factor types
97
- * @throws {Error} May throw an error if the API request fails
98
- *
99
- * @example
100
- * const types = await getTypes();
101
- */
102
- export async function getTypes(
103
- ): Promise<TypeResponse> {
104
- const client = Client.getInstance();
105
- const url = client.getDomain() + FACTOR_API_TYPES;
106
-
107
- return makeApiRequest<TypeResponse>({
108
- method: GET,
109
- url
110
- });
111
- }
112
-
113
- /**
114
- * Retrieves information about geographical areas supported by the factor search API.
115
- *
116
- * @export
117
- * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
118
- * @throws {Error} May throw an error if the API request fails
119
- *
120
- * @example
121
- * const areas = await getSearchArea();
122
- */
123
- export async function getSearchArea(
124
- ): Promise<AreaResponse> {
125
- const client = Client.getInstance();
126
- const url = client.getDomain() + SEARCH_API_AREA;
127
-
128
- return makeApiRequest<AreaResponse>({
129
- method: GET,
130
- url
131
- });
132
- }
133
-
134
- /**
135
- * Retrieves information about geographical areas supported by the factor API.
136
- *
137
- * @export
138
- * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
139
- * @throws {Error} May throw an error if the API request fails
140
- *
141
- * @example
142
- * const areas = await getArea();
143
- */
144
- export async function getArea(): Promise<AreaResponse> {
145
- const client = Client.getInstance();
146
- const url = client.getDomain() + FACTOR_API_AREA;
147
-
148
- return makeApiRequest<AreaResponse>({
149
- method: GET,
150
- url
151
- });
152
- }
153
-
154
- /**
155
- * Retrieves available units for a specific emission factor type.
156
- *
157
- * @export
158
- * @param {string} type - The emission factor type to get units for (e.g., "Natural Gas - Scope 3:AAA")
159
- * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
160
- * @throws {Error} May throw an error if the API request fails
161
- *
162
- * @example
163
- * // Get units for the "Natural Gas - Scope 3:AAA" emission factor type with subtype
164
- * const units = await getUnits("Natural Gas - Scope 3:AAA");
165
-
166
- * // Get units for the "HFC-263fb" emission factor type without subtype
167
- * const units = await getUnits("HFC-263fb");
168
- */
169
- export async function getUnits(
170
- type : string
171
- ): Promise<UnitResponse> {
172
- const client = Client.getInstance();
173
- const url = client.getDomain() + FACTOR_API_UNITS;
174
-
175
- return makeApiRequest<UnitResponse>({
176
- method: GET,
177
- url,
178
- params : { type }
179
- });
180
87
  }
@@ -1,11 +1,8 @@
1
1
  import { Client } from "../Client";
2
- import { FUGITIVE_API_AREA, FUGITIVE_API_PATH, FUGITIVE_API_TYPES, FUGITIVE_API_UNITS, GET, POST } from "../Constants";
2
+ import { FUGITIVE_API_PATH, POST } from "../Constants";
3
3
  import { CommonRequest } from "../interfaces/Api";
4
- import { AreaResponse } from "../interfaces/response/AreaResponse";
5
4
  import { EmissionResponse } from "../interfaces/response/EmissionResponse";
6
5
  import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
7
- import { TypeResponse } from "../interfaces/response/TypeResponse";
8
- import { UnitResponse } from "../interfaces/response/UnitResponse";
9
6
  import { makeApiRequest } from "../request";
10
7
 
11
8
  /**
@@ -46,73 +43,3 @@ export async function calculate(
46
43
  data: payload,
47
44
  });
48
45
  }
49
-
50
- /**
51
- * Retrieves available fugitive emission calculation types by making a GET request to the API endpoint.
52
- *
53
- * @export
54
- * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available fugitive emission types
55
- * @throws {Error} May throw an error if the API request fails
56
- *
57
- * @example
58
- * const types = await getTypes();
59
- */
60
- export async function getTypes(
61
- ): Promise<TypeResponse> {
62
- const client = Client.getInstance();
63
- const url = client.getDomain() + FUGITIVE_API_TYPES;
64
-
65
- return makeApiRequest<TypeResponse>({
66
- method: GET,
67
- url
68
- });
69
- }
70
-
71
- /**
72
- * Retrieves information about geographical areas supported by the fugitive emissions API.
73
- *
74
- * @export
75
- * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
76
- * @throws {Error} May throw an error if the API request fails
77
- *
78
- * @example
79
- * const areas = await getArea();
80
- */
81
- export async function getArea(
82
- ): Promise<AreaResponse> {
83
- const client = Client.getInstance();
84
- const url = client.getDomain() + FUGITIVE_API_AREA;
85
-
86
- return makeApiRequest<AreaResponse>({
87
- method: GET,
88
- url
89
- });
90
- }
91
-
92
- /**
93
- * Retrieves available units for a specific fugitive emission type.
94
- *
95
- * @export
96
- * @param {string} type - The fugitive emission type to get units for (e.g., "R134A")
97
- * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
98
- * @throws {Error} May throw an error if the API request fails
99
- *
100
- * @example
101
- * // Get units for the "Natural Gas - Scope 3:AAA" emission fugitive type with subtype
102
- * const units = await getUnits("Natural Gas - Scope 3:AAA");
103
-
104
- * // Get units for the "R-426A" emission fugitive type without subtype
105
- * const units = await getUnits("R-426A");
106
- */
107
- export async function getUnits(
108
- type : string
109
- ): Promise<UnitResponse> {
110
- const client = Client.getInstance();
111
- const url = client.getDomain() + FUGITIVE_API_UNITS;
112
-
113
- return makeApiRequest<UnitResponse>({
114
- method: GET,
115
- url,
116
- params : { type }
117
- });
118
- }
@@ -1,11 +1,8 @@
1
1
  import { Client } from "../Client";
2
- import { GET, LOCATION_API_AREA, LOCATION_API_PATH, LOCATION_API_UNITS, LOCATION_TYPES, POST } from "../Constants";
2
+ import { LOCATION_API_PATH, POST } from "../Constants";
3
3
  import { LocationRequest } from "../interfaces/Api";
4
- import { AreaResponse } from "../interfaces/response/AreaResponse";
5
4
  import { EmissionResponse } from "../interfaces/response/EmissionResponse";
6
5
  import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
7
- import { TypeResponse } from "../interfaces/response/TypeResponse";
8
- import { UnitResponse } from "../interfaces/response/UnitResponse";
9
6
  import { makeApiRequest } from "../request";
10
7
 
11
8
  /**
@@ -45,73 +42,4 @@ export async function calculate(
45
42
  url,
46
43
  data: payload,
47
44
  });
48
- }
49
-
50
-
51
- /**
52
- * Retrieves available location-based calculation types by making a GET request to the location types API endpoint.
53
- *
54
- * @export
55
- * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available location-based calculation types
56
- * @throws {Error} May throw an error if the API request fails
57
- *
58
- * @example
59
- *
60
- * const types = await getTypes();
61
- */
62
- export async function getTypes(
63
- ): Promise<TypeResponse> {
64
- const client = Client.getInstance();
65
- const url = client.getDomain() + LOCATION_TYPES;
66
-
67
- return makeApiRequest<TypeResponse>({
68
- method: GET,
69
- url
70
- });
71
- }
72
-
73
- /**
74
- * Retrieves information about geographical areas supported by the location-based calculation API.
75
- *
76
- * @export
77
- * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
78
- * @throws {Error} May throw an error if the API request fails
79
- *
80
- * @example
81
- * const areas = await getArea();
82
- */
83
- export async function getArea(
84
- ): Promise<AreaResponse> {
85
- const client = Client.getInstance();
86
- const url = client.getDomain() + LOCATION_API_AREA;
87
-
88
- return makeApiRequest<AreaResponse>({
89
- method: GET,
90
- url
91
- });
92
- }
93
-
94
- /**
95
- * Retrieves available units for a specific location-based calculation type.
96
- *
97
- * @export
98
- * @param {string} type - The location-based calculation type to get units for (e.g., "electricity")
99
- * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
100
- * @throws {Error} May throw an error if the API request fails
101
- *
102
- * @example
103
- * // Get units for the "electricity" location type
104
- * const units = await getUnits("electricity");
105
- */
106
- export async function getUnits(
107
- type : string
108
- ): Promise<UnitResponse> {
109
- const client = Client.getInstance();
110
- const url = client.getDomain() + LOCATION_API_UNITS;
111
-
112
- return makeApiRequest<UnitResponse>({
113
- method: GET,
114
- url,
115
- params : { type }
116
- });
117
45
  }