emissions-api-sdk 1.0.5 → 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 (90) hide show
  1. package/README.md +19 -26
  2. package/dist/Constants.js +4 -29
  3. package/dist/api/Calculation.js +0 -63
  4. package/dist/api/EconomicActivity.js +0 -60
  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 +0 -61
  11. package/dist/api/Stationary.js +0 -63
  12. package/dist/api/TransportationAndDistribution.js +0 -63
  13. package/dist/coverage/clover.xml +132 -239
  14. package/dist/coverage/coverage-final.json +14 -13
  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 +29 -110
  18. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +7 -217
  19. package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +7 -214
  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 +6 -219
  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 +48 -33
  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 +221 -354
  43. package/dist/index.js +2 -1
  44. package/dist/types/Constants.d.ts +3 -28
  45. package/dist/types/api/Calculation.d.ts +0 -41
  46. package/dist/types/api/EconomicActivity.d.ts +0 -38
  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 +0 -39
  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 +1 -0
  56. package/docs/_sources/reference.rst.txt +14 -50
  57. package/docs/_static/basic.css +8 -0
  58. package/docs/_static/pygments.css +146 -164
  59. package/docs/_static/searchtools.js +5 -8
  60. package/docs/_static/styles/furo.css +1 -1
  61. package/docs/_static/styles/furo.css.map +1 -1
  62. package/docs/authentication.html +28 -19
  63. package/docs/client.html +28 -19
  64. package/docs/genindex.html +41 -84
  65. package/docs/getting_started.html +28 -19
  66. package/docs/index.html +29 -20
  67. package/docs/objects.inv +0 -0
  68. package/docs/reference.html +102 -502
  69. package/docs/sdk.html +28 -19
  70. package/docs/search.html +28 -19
  71. package/docs/searchindex.js +1 -1
  72. package/docs/troubleshooting.html +28 -19
  73. package/package.json +5 -3
  74. package/sphinx-build/source/reference.rst +14 -50
  75. package/src/Constants.ts +4 -31
  76. package/src/api/Calculation.ts +1 -72
  77. package/src/api/EconomicActivity.ts +1 -71
  78. package/src/api/Factor.ts +1 -94
  79. package/src/api/Fugitive.ts +1 -74
  80. package/src/api/Location.ts +1 -73
  81. package/src/api/Metadata.ts +174 -0
  82. package/src/api/Mobile.ts +1 -76
  83. package/src/api/RealEstate.ts +1 -72
  84. package/src/api/Stationary.ts +1 -74
  85. package/src/api/TransportationAndDistribution.ts +1 -74
  86. package/src/index.ts +1 -0
  87. package/test/apiTest.test.ts +0 -205
  88. package/test/metadata.test.ts +224 -0
  89. package/test/request.test.ts +0 -1
  90. package/sphinx-build/.secrets.baseline +0 -150
@@ -31,73 +31,37 @@ API
31
31
 
32
32
  .. js:autofunction:: EconomicActivity.calculate
33
33
 
34
- Metadata APIs
35
- ===========
36
-
37
- getTypes
38
- --------
39
-
40
- .. js:autofunction:: Factor.getTypes
41
-
42
- .. js:autofunction:: Calculation.getTypes
43
34
 
44
- .. js:autofunction:: Location.getTypes
35
+ Global Metadata API
36
+ ====================
45
37
 
46
- .. js:autofunction:: Mobile.getTypes
38
+ The global Metadata API provides a unified way to query metadata across different endpoints without calling endpoint-specific methods.
47
39
 
48
- .. js:autofunction:: Stationary.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
49
42
 
50
- .. js:autofunction:: TransportationAndDistribution.getTypes
43
+ **Supported endpoints** (for getTypes/postTypes and getArea/postArea): ``calculation``, ``location``, ``stationary``, ``mobile``, ``fugitive``, ``factor``, ``search``, ``transportation-and-distribution``, ``economic-activity``, ``real-estate``
51
44
 
52
- .. js:autofunction:: Fugitive.getTypes
45
+ getTypes
46
+ --------
53
47
 
54
- .. js:autofunction:: RealEstate.getTypes
48
+ .. js:autofunction:: Metadata.getTypes
55
49
 
56
- .. js:autofunction:: EconomicActivity.getTypes
50
+ .. js:autofunction:: Metadata.postTypes
57
51
 
58
52
  getArea
59
53
  -------
60
54
 
61
- .. js:autofunction:: Factor.getArea
62
-
63
- .. js:autofunction:: Factor.getSearchArea
64
-
65
- .. js:autofunction:: Calculation.getArea
66
-
67
- .. js:autofunction:: Location.getArea
68
-
69
- .. js:autofunction:: Mobile.getArea
55
+ .. js:autofunction:: Metadata.getArea
70
56
 
71
- .. js:autofunction:: Stationary.getArea
72
-
73
- .. js:autofunction:: TransportationAndDistribution.getArea
74
-
75
- .. js:autofunction:: Fugitive.getArea
76
-
77
- .. js:autofunction:: RealEstate.getArea
78
-
79
- .. js:autofunction:: EconomicActivity.getArea
57
+ .. js:autofunction:: Metadata.postArea
80
58
 
81
59
  getUnits
82
60
  --------
83
61
 
84
- .. js:autofunction:: Factor.getUnits
85
-
86
- .. js:autofunction:: Calculation.getUnits
87
-
88
- .. js:autofunction:: Location.getUnits
89
-
90
- .. js:autofunction:: Mobile.getUnits
91
-
92
- .. js:autofunction:: Stationary.getUnits
93
-
94
- .. js:autofunction:: TransportationAndDistribution.getUnits
95
-
96
- .. js:autofunction:: Fugitive.getUnits
97
-
98
- .. js:autofunction:: RealEstate.getUnits
62
+ .. js:autofunction:: Metadata.getUnits
99
63
 
100
- .. js:autofunction:: EconomicActivity.getUnits
64
+ .. js:autofunction:: Metadata.postUnits
101
65
 
102
66
 
103
67
  Usage API
package/src/Constants.ts CHANGED
@@ -12,39 +12,12 @@ export const SEARCH_API_PATH = "/v3/carbon/factor/search";
12
12
  export const ECONOMIC_ACTIVITY_API_PATH = "/v3/carbon/economic-activity";
13
13
  export const REAL_ESTATE_API_PATH = "/v3/carbon/real-estate";
14
14
 
15
- export const CALCULATION_TYPES = "/v3/carbon/calculation/types";
16
- export const LOCATION_TYPES = "/v3/carbon/location/types";
17
- export const FUGITIVE_API_TYPES = "/v3/carbon/fugitive/types";
18
- export const MOBILE_API_TYPES = "/v3/carbon/mobile/types";
19
- export const STATIONARY_API_TYPES = "/v3/carbon/stationary/types";
20
- export const FACTOR_API_TYPES = "/v3/carbon/factor/types";
21
- export const TRANSPORTATION_AND_DISTRIBUTION_API_TYPES = "/v3/carbon/transportation-and-distribution/types";
22
- export const REAL_ESTATE_API_TYPES = "/v3/carbon/real-estate/types";
23
- export const ECONOMIC_ACTIVITY_API_TYPES = "/v3/carbon/economic-activity/types";
24
-
25
- export const FUGITIVE_API_AREA = "/v3/carbon/fugitive/area";
26
- export const GENERAL_API_AREA = "/v3/carbon/calculation/area";
27
- export const LOCATION_API_AREA = "/v3/carbon/location/area";
28
- export const MOBILE_API_AREA = "/v3/carbon/mobile/area";
29
- export const STATIONARY_API_AREA = "/v3/carbon/stationary/area";
30
- export const TRANSPORTATION_AND_DISTRIBUTION_API_AREA = "/v3/carbon/transportation-and-distribution/area";
31
- export const SEARCH_API_AREA = "/v3/carbon/factor/search/area";
32
- export const FACTOR_API_AREA = "/v3/carbon/factor/area";
33
- export const REAL_ESTATE_API_AREA = "/v3/carbon/real-estate/area";
34
- export const ECONOMIC_ACTIVITY_API_AREA = "/v3/carbon/economic-activity/area";
35
-
36
- export const FUGITIVE_API_UNITS = "/v3/carbon/fugitive/units";
37
- export const LOCATION_API_UNITS = "/v3/carbon/location/units";
38
- export const MOBILE_API_UNITS = "/v3/carbon/mobile/units";
39
- export const STATIONARY_API_UNITS = "/v3/carbon/stationary/units";
40
- export const GENERAL_API_UNITS = "/v3/carbon/calculation/units";
41
- export const FACTOR_API_UNITS = "/v3/carbon/factor/units";
42
- export const TRANSPORTATION_AND_DISTRIBUTION_API_UNITS = "/v3/carbon/transportation-and-distribution/units";
43
- export const REAL_ESTATE_API_UNITS = "/v3/carbon/real-estate/units";
44
- export const ECONOMIC_ACTIVITY_API_UNITS = "/v3/carbon/economic-activity/units";
45
-
46
15
  export const USAGE_API = "/v3/carbon/usage";
47
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
+
48
21
  export const GET = "GET";
49
22
  export const POST = "POST";
50
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
- }
@@ -1,11 +1,8 @@
1
1
  import { Client } from "../Client";
2
- import { ECONOMIC_ACTIVITY_API_PATH, ECONOMIC_ACTIVITY_API_AREA, ECONOMIC_ACTIVITY_API_TYPES, ECONOMIC_ACTIVITY_API_UNITS, GET, POST } from "../Constants";
2
+ import { ECONOMIC_ACTIVITY_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,70 +43,3 @@ export async function calculate(
46
43
  data: payload,
47
44
  });
48
45
  }
49
-
50
- /**
51
- * Retrieves available economic activity 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 economic activity 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() + ECONOMIC_ACTIVITY_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 economic activity 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() + ECONOMIC_ACTIVITY_API_AREA;
85
-
86
- return makeApiRequest<AreaResponse>({
87
- method: GET,
88
- url
89
- });
90
- }
91
-
92
- /**
93
- * Retrieves available units for a specific economic activity emission type.
94
- *
95
- * @export
96
- * @param {string} type - The economic activity emission type to get units for (e.g., "accomodation")
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 "accomodation" emission economic activity type without subtype
102
- * const units = await getUnits("accomodation");
103
- */
104
- export async function getUnits(
105
- type : string
106
- ): Promise<UnitResponse> {
107
- const client = Client.getInstance();
108
- const url = client.getDomain() + ECONOMIC_ACTIVITY_API_UNITS;
109
-
110
- return makeApiRequest<UnitResponse>({
111
- method: GET,
112
- url,
113
- params : { type }
114
- });
115
- }
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
  }