emissions-api-sdk 1.0.1 → 1.0.3

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 (115) hide show
  1. package/README.md +9 -0
  2. package/dist/Constants.js +2 -1
  3. package/dist/api/Calculation.js +4 -4
  4. package/dist/api/Factor.js +7 -7
  5. package/dist/api/FactorSets.js +1 -1
  6. package/dist/api/Fugitive.js +4 -4
  7. package/dist/api/Location.js +4 -4
  8. package/dist/api/Mobile.js +4 -6
  9. package/dist/api/Stationary.js +4 -4
  10. package/dist/api/TransportationAndDistribution.js +5 -5
  11. package/dist/api/Usage.js +26 -0
  12. package/dist/coverage/clover.xml +346 -0
  13. package/dist/coverage/coverage-final.json +20 -0
  14. package/dist/coverage/lcov-report/base.css +224 -0
  15. package/dist/coverage/lcov-report/block-navigation.js +87 -0
  16. package/dist/coverage/lcov-report/favicon.png +0 -0
  17. package/dist/coverage/lcov-report/index.html +161 -0
  18. package/dist/coverage/lcov-report/prettify.css +1 -0
  19. package/dist/coverage/lcov-report/prettify.js +2 -0
  20. package/dist/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  21. package/dist/coverage/lcov-report/sorter.js +210 -0
  22. package/dist/coverage/lcov-report/src/Client.ts.html +838 -0
  23. package/dist/coverage/lcov-report/src/Constants.ts.html +214 -0
  24. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +436 -0
  25. package/dist/coverage/lcov-report/src/api/Factor.ts.html +622 -0
  26. package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +157 -0
  27. package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +436 -0
  28. package/dist/coverage/lcov-report/src/api/Location.ts.html +433 -0
  29. package/dist/coverage/lcov-report/src/api/Mobile.ts.html +448 -0
  30. package/dist/coverage/lcov-report/src/api/Stationary.ts.html +442 -0
  31. package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +436 -0
  32. package/dist/coverage/lcov-report/src/api/Usage.ts.html +160 -0
  33. package/dist/coverage/lcov-report/src/api/index.html +236 -0
  34. package/dist/coverage/lcov-report/src/index.html +161 -0
  35. package/dist/coverage/lcov-report/src/request.ts.html +235 -0
  36. package/dist/coverage/lcov-report/src/utils.ts.html +139 -0
  37. package/dist/coverage/lcov-report/test/index.html +116 -0
  38. package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +142 -0
  39. package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +133 -0
  40. package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +142 -0
  41. package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +139 -0
  42. package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +142 -0
  43. package/dist/coverage/lcov-report/test/mocks/index.html +176 -0
  44. package/dist/coverage/lcov-report/test/testUtils.ts.html +97 -0
  45. package/dist/coverage/lcov.info +578 -0
  46. package/dist/index.js +2 -1
  47. package/dist/interfaces/response/AreaResponse.js +2 -0
  48. package/dist/interfaces/response/EmissionResponse.js +2 -0
  49. package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
  50. package/dist/interfaces/response/FactorResponse.js +2 -0
  51. package/dist/interfaces/response/FactorSetResponse.js +2 -0
  52. package/dist/interfaces/response/SearchResponse.js +2 -0
  53. package/dist/interfaces/response/TypeResponse.js +2 -0
  54. package/dist/interfaces/response/UnitResponse.js +2 -0
  55. package/dist/interfaces/response/UsageResponse.js +5 -0
  56. package/dist/types/Constants.d.ts +1 -0
  57. package/dist/types/api/Calculation.d.ts +13 -8
  58. package/dist/types/api/Factor.d.ts +18 -13
  59. package/dist/types/api/FactorSets.d.ts +3 -2
  60. package/dist/types/api/Fugitive.d.ts +13 -8
  61. package/dist/types/api/Location.d.ts +13 -8
  62. package/dist/types/api/Mobile.d.ts +13 -10
  63. package/dist/types/api/Stationary.d.ts +13 -8
  64. package/dist/types/api/TransportationAndDistribution.d.ts +14 -9
  65. package/dist/types/api/Usage.d.ts +13 -0
  66. package/dist/types/index.d.ts +10 -0
  67. package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
  68. package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
  69. package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
  70. package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
  71. package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
  72. package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
  73. package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
  74. package/dist/types/interfaces/response/UnitResponse.d.ts +16 -0
  75. package/dist/types/interfaces/response/UsageResponse.d.ts +17 -0
  76. package/docs/_sources/index.rst.txt +1 -0
  77. package/docs/_sources/reference.rst.txt +6 -0
  78. package/docs/_sources/troubleshooting.rst.txt +486 -0
  79. package/docs/authentication.html +1 -0
  80. package/docs/client.html +1 -0
  81. package/docs/genindex.html +5 -0
  82. package/docs/getting_started.html +1 -0
  83. package/docs/index.html +15 -0
  84. package/docs/objects.inv +0 -0
  85. package/docs/reference.html +71 -35
  86. package/docs/sdk.html +1 -0
  87. package/docs/search.html +1 -0
  88. package/docs/searchindex.js +1 -1
  89. package/docs/troubleshooting.html +777 -0
  90. package/package.json +1 -1
  91. package/sphinx-build/requirements.txt +5 -0
  92. package/sphinx-build/source/index.rst +1 -0
  93. package/sphinx-build/source/reference.rst +6 -0
  94. package/sphinx-build/source/troubleshooting.rst +486 -0
  95. package/src/Constants.ts +2 -0
  96. package/src/api/Calculation.ts +19 -14
  97. package/src/api/Factor.ts +27 -22
  98. package/src/api/FactorSets.ts +4 -3
  99. package/src/api/Fugitive.ts +19 -14
  100. package/src/api/Location.ts +20 -15
  101. package/src/api/Mobile.ts +19 -16
  102. package/src/api/Stationary.ts +19 -14
  103. package/src/api/TransportationAndDistribution.ts +21 -16
  104. package/src/api/Usage.ts +26 -0
  105. package/src/index.ts +35 -1
  106. package/src/interfaces/response/AreaResponse.ts +25 -0
  107. package/src/interfaces/response/EmissionResponse.ts +44 -0
  108. package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
  109. package/src/interfaces/response/FactorResponse.ts +78 -0
  110. package/src/interfaces/response/FactorSetResponse.ts +52 -0
  111. package/src/interfaces/response/SearchResponse.ts +52 -0
  112. package/src/interfaces/response/TypeResponse.ts +7 -0
  113. package/src/interfaces/response/UnitResponse.ts +17 -0
  114. package/src/interfaces/response/UsageResponse.ts +23 -0
  115. package/test/apiTest.test.ts +35 -4
@@ -1,16 +1,21 @@
1
1
  import { Client } from "../Client";
2
2
  import { TRANSPORTATION_AND_DISTRIBUTION_API_PATH, POST, TRANSPORTATION_AND_DISTRIBUTION_API_TYPES, GET, TRANSPORTATION_AND_DISTRIBUTION_API_AREA, TRANSPORTATION_AND_DISTRIBUTION_API_UNITS } from "../Constants";
3
3
  import { CalculationRequest } from "../interfaces/Api";
4
+ import { AreaResponse } from "../interfaces/response/AreaResponse";
5
+ import { EmissionResponse } from "../interfaces/response/EmissionResponse";
6
+ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
7
+ import { TypeResponse } from "../interfaces/response/TypeResponse";
8
+ import { UnitResponse } from "../interfaces/response/UnitResponse";
4
9
  import { makeApiRequest } from "../request";
5
10
 
6
11
  /**
7
- * Performs Scope 2 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
8
- *
12
+ * Performs Scope 3 transportation and distribution emission calculations by making a POST request to the transportation and distribution API endpoint.
13
+ *
9
14
  * @export
10
15
  * @param {CalculationRequest} payload - The calculation request data for transportation and distribution operations
11
- * @return {Promise<string>} A promise that resolves to the calculation result string returned by the API
16
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
12
17
  * @throws {Error} May throw an error if the API request fails
13
- *
18
+ *
14
19
  * @example
15
20
  * const request = {
16
21
  "time" : {
@@ -30,11 +35,11 @@ import { makeApiRequest } from "../request";
30
35
  */
31
36
  export async function calculate(
32
37
  payload: CalculationRequest
33
- ): Promise<string> {
38
+ ): Promise<EmissionResponse | EmissionResponseWithDetails> {
34
39
  const client = Client.getInstance();
35
40
  const url = client.getDomain() + TRANSPORTATION_AND_DISTRIBUTION_API_PATH;
36
41
 
37
- return makeApiRequest<string>({
42
+ return makeApiRequest<EmissionResponse | EmissionResponseWithDetails>({
38
43
  method: POST,
39
44
  url,
40
45
  data: payload,
@@ -46,18 +51,18 @@ export async function calculate(
46
51
  * Retrieves available transportation and distribution calculation types by making a GET request to the API endpoint.
47
52
  *
48
53
  * @export
49
- * @return {Promise<string>} A promise that resolves to a string containing the available transportation and distribution calculation types
54
+ * @return {Promise<TypeResponse>} A promise that resolves to a TypeResponse containing the available transportation and distribution calculation types
50
55
  * @throws {Error} May throw an error if the API request fails
51
56
  *
52
57
  * @example
53
58
  * const types = await getTypes();
54
59
  */
55
60
  export async function getTypes(
56
- ): Promise<string> {
61
+ ): Promise<TypeResponse> {
57
62
  const client = Client.getInstance();
58
63
  const url = client.getDomain() + TRANSPORTATION_AND_DISTRIBUTION_API_TYPES;
59
64
 
60
- return makeApiRequest<string>({
65
+ return makeApiRequest<TypeResponse>({
61
66
  method: GET,
62
67
  url
63
68
  });
@@ -67,18 +72,18 @@ export async function getTypes(
67
72
  * Retrieves information about geographical areas supported by the transportation and distribution API.
68
73
  *
69
74
  * @export
70
- * @return {Promise<string>} A promise that resolves to a string containing the supported geographical areas
75
+ * @return {Promise<AreaResponse>} A promise that resolves to an AreaResponse containing the supported geographical areas
71
76
  * @throws {Error} May throw an error if the API request fails
72
77
  *
73
78
  * @example
74
79
  * const areas = await getArea();
75
80
  */
76
81
  export async function getArea(
77
- ): Promise<string> {
82
+ ): Promise<AreaResponse> {
78
83
  const client = Client.getInstance();
79
84
  const url = client.getDomain() + TRANSPORTATION_AND_DISTRIBUTION_API_AREA;
80
85
 
81
- return makeApiRequest<string>({
86
+ return makeApiRequest<AreaResponse>({
82
87
  method: GET,
83
88
  url
84
89
  });
@@ -89,23 +94,23 @@ export async function getArea(
89
94
  *
90
95
  * @export
91
96
  * @param {string} type - The transportation and distribution calculation type to get units for (e.g., "Freight - Cargo Ship")
92
- * @return {Promise<string>} A promise that resolves to a string containing the available units
97
+ * @return {Promise<UnitResponse>} A promise that resolves to a UnitResponse containing the available units
93
98
  * @throws {Error} May throw an error if the API request fails
94
99
  *
95
100
  * @example
96
101
  * // Get units for the "Business Travel - Cars:Diesel - Small" transportation and distribution type without subtype
97
102
  * const units = await getUnits("Business Travel - Cars:Diesel - Small");
98
- *
103
+ *
99
104
  * // Get units for the "Business Travel - Cars" transportation and distribution type with subtype
100
105
  * const units = await getUnits("Business Travel - Cars");
101
106
  */
102
107
  export async function getUnits(
103
108
  type : string
104
- ): Promise<string> {
109
+ ): Promise<UnitResponse> {
105
110
  const client = Client.getInstance();
106
111
  const url = client.getDomain() + TRANSPORTATION_AND_DISTRIBUTION_API_UNITS;
107
112
 
108
- return makeApiRequest<string>({
113
+ return makeApiRequest<UnitResponse>({
109
114
  method: GET,
110
115
  url,
111
116
  params : { type }
@@ -0,0 +1,26 @@
1
+ import { Client } from "../Client";
2
+ import { GET, USAGE_API } from "../Constants";
3
+ import { UsageResponse } from "../interfaces/response/UsageResponse";
4
+ import { makeApiRequest } from "../request";
5
+
6
+ /**
7
+ * Retrieves current billing period or historical usage data for the user by making a GET request to the API endpoint.
8
+ *
9
+ * @export
10
+ * @param {boolean} history - Flag to retrieve current billing or historical usage data.
11
+ * @return {Promise<UsageResponse>} A promise that resolves to a UsageResponse containing the organization's usage data
12
+ * @throws {Error} May throw an error if the API request fails
13
+ *
14
+ * @example
15
+ * const usage = await getUsage();
16
+ */
17
+ export async function getUsage(history : boolean = false): Promise<UsageResponse> {
18
+ const client = Client.getInstance();
19
+ const url = client.getDomain() + USAGE_API;
20
+
21
+ return makeApiRequest<UsageResponse>({
22
+ method: GET,
23
+ url,
24
+ params : { history }
25
+ });
26
+ }
package/src/index.ts CHANGED
@@ -5,6 +5,40 @@ export * as Mobile from './api/Mobile';
5
5
  export * as Stationary from './api/Stationary';
6
6
  export * as Calculation from './api/Calculation';
7
7
  export * as TransportationAndDistribution from './api/TransportationAndDistribution';
8
+ export * as Usage from './api/Usage'
8
9
  export * as Factor from './api/Factor';
9
10
  export * as FactorSets from './api/FactorSets'
10
- export { ClientConfig } from './interfaces/Config';
11
+ export { ClientConfig } from './interfaces/Config';
12
+
13
+ // Response interfaces
14
+ export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
15
+ export { EmissionResponse } from './interfaces/response/EmissionResponse';
16
+ export {
17
+ EmissionResponseWithDetails,
18
+ UnitInfo,
19
+ AreaInfo,
20
+ AreaType,
21
+ FactorDataTypeCategory,
22
+ FactorSetInfo,
23
+ FactorSelectionDefault,
24
+ FactorDataTypeCode,
25
+ FactorSetVersion,
26
+ FactorValue,
27
+ FactorMetaData,
28
+ UnitConversion,
29
+ EmissionData
30
+ } from './interfaces/response/EmissionResponseWithDetails';
31
+ export { FactorResponse } from './interfaces/response/FactorResponse';
32
+ export {
33
+ FactorSetResponse,
34
+ FactorSet
35
+ } from './interfaces/response/FactorSetResponse';
36
+ export {
37
+ SearchResponse,
38
+ Pagination,
39
+ PaginationBody,
40
+ SearchLink
41
+ } from './interfaces/response/SearchResponse';
42
+ export { TypeResponse } from './interfaces/response/TypeResponse';
43
+ export { UnitResponse } from './interfaces/response/UnitResponse';
44
+ export { UsageResponse } from './interfaces/response/UsageResponse';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Interface representing a location with geographical and power grid information
3
+ */
4
+ export interface Location {
5
+ /** ISO 3166-1 alpha-3 country code */
6
+ alpha3: string;
7
+
8
+ /** Full country name */
9
+ countryName: string;
10
+
11
+ /** List of state or province names (optional) */
12
+ stateProvinces?: string[];
13
+
14
+ /** List of power grid identifiers (optional) */
15
+ powerGrids?: string[];
16
+ }
17
+
18
+ /**
19
+ * Interface representing the response from the area/location API
20
+ */
21
+ export interface AreaResponse {
22
+ /** Array of location objects */
23
+ locations: Location[];
24
+ }
25
+
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Interface representing the emission calculation response
3
+ */
4
+ export interface EmissionResponse {
5
+ /** Unique transaction identifier (required) */
6
+ transactionId: string;
7
+
8
+ /** Total CO2 equivalent emissions (required) */
9
+ totalCO2e: number;
10
+
11
+ /** CO2 emissions value (optional) */
12
+ CO2?: number;
13
+
14
+ /** CH4 (Methane) emissions value (optional) */
15
+ CH4?: number;
16
+
17
+ /** N2O (Nitrous Oxide) emissions value (optional) */
18
+ N2O?: number;
19
+
20
+ /** Biogenic CO2 emissions value (optional) */
21
+ bioCO2?: number;
22
+
23
+ /** Indirect CO2 equivalent emissions value (optional) */
24
+ indirectCO2e?: number;
25
+
26
+ /** Hydrofluorocarbon emissions value (optional) */
27
+ HFC?: number;
28
+
29
+ /** Perfluorocarbon emissions value (optional) */
30
+ PFC?: number;
31
+
32
+ /** Sulfur hexafluoride emissions value (optional) */
33
+ SF6?: number;
34
+
35
+ /** Nitrogen trifluoride emissions value (optional) */
36
+ NF3?: number;
37
+
38
+ /** Unit of measurement for emissions (required) */
39
+ unit: string;
40
+
41
+ /** Description of the emission calculation (required) */
42
+ description: string;
43
+ }
44
+
@@ -0,0 +1,183 @@
1
+ import { EmissionResponse } from './EmissionResponse';
2
+
3
+ /**
4
+ * Interface for unit information in emission details
5
+ */
6
+ export interface UnitInfo {
7
+ /** Unit name */
8
+ name: string;
9
+
10
+ /** Unit description (optional) */
11
+ description?: string;
12
+ }
13
+
14
+ /**
15
+ * Interface for area information
16
+ */
17
+ export interface AreaInfo {
18
+ /** Internal name of the area */
19
+ internalName: string;
20
+
21
+ /** Standard name of the area */
22
+ standardName: string;
23
+
24
+ alpha3?: string;
25
+ }
26
+
27
+ /**
28
+ * Interface for area type information
29
+ */
30
+ export interface AreaType {
31
+ /** Type name (e.g., "Planet", "State") */
32
+ name: string;
33
+ }
34
+
35
+ /**
36
+ * Interface for factor data type categories
37
+ */
38
+ export interface FactorDataTypeCategory {
39
+ /** Category name */
40
+ name: string;
41
+ }
42
+
43
+ /**
44
+ * Interface for factor set information
45
+ */
46
+ export interface FactorSetInfo {
47
+ /** Factor set type */
48
+ type: string;
49
+
50
+ /** Description of the factor set */
51
+ description?: string;
52
+
53
+ /** Provider of the factor set */
54
+ provider?: string;
55
+
56
+ /** Source URL for the factor set */
57
+ sourceUrl?: string;
58
+
59
+ factorSource?: string;
60
+ }
61
+ export interface FactorSelectionDefault {
62
+ actorDataType?: string;
63
+ areaName?: string;
64
+ factorSetName?: string;
65
+ }
66
+ /**
67
+ * Interface for factor data type code
68
+ */
69
+ export interface FactorDataTypeCode {
70
+ /** Unit of measure */
71
+ unitOfMeasure: string;
72
+
73
+ /** Activity type */
74
+ type: string;
75
+
76
+ /** Activity subtype */
77
+ subtype: string;
78
+
79
+ /** Unique factor identifier */
80
+ factorId: number;
81
+ }
82
+
83
+ /**
84
+ * Interface for factor set version information
85
+ */
86
+ export interface FactorSetVersion {
87
+ /** Publication start date */
88
+ publishedFrom?: string;
89
+
90
+ /** Publication end date (optional) */
91
+ publishedTo?: string;
92
+
93
+ /** Source of the factor */
94
+ factorSource: string;
95
+ }
96
+
97
+ /**
98
+ * Interface for factor value
99
+ */
100
+ export interface FactorValue {
101
+ /** Unit information */
102
+ unit: {
103
+ /** Unit name */
104
+ name: string;
105
+ };
106
+
107
+ /** Factor value */
108
+ value: number;
109
+ }
110
+
111
+ /**
112
+ * Interface for factor metadata
113
+ */
114
+ export interface FactorMetaData {
115
+ /** Metadata key */
116
+ key: string;
117
+
118
+ /** Metadata value */
119
+ value: string;
120
+ }
121
+
122
+ /**
123
+ * Interface for unit conversion information
124
+ */
125
+ export interface UnitConversion {
126
+ /** Input unit */
127
+ inputUnit: string;
128
+
129
+ /** Unit from database */
130
+ unitFromDb: string;
131
+
132
+ /** Conversion ratio */
133
+ conversionRatio: string;
134
+ }
135
+
136
+ /**
137
+ * Interface for detailed emission data
138
+ */
139
+ export interface EmissionData {
140
+ /** Array of unit information */
141
+ unit: UnitInfo[];
142
+
143
+ /** Array of area information */
144
+ area: AreaInfo[];
145
+
146
+ /** Array of area types */
147
+ areaType: AreaType[];
148
+
149
+ /** Array of factor data type categories */
150
+ factorDataTypeCategories: FactorDataTypeCategory[];
151
+
152
+ factorSelectionDefault? :FactorSelectionDefault[];
153
+
154
+ /** Array of factor set information */
155
+ factorSet: FactorSetInfo[];
156
+
157
+ /** Array of factor data type codes */
158
+ factorDataTypeCode: FactorDataTypeCode[];
159
+
160
+ /** Array of factor set versions */
161
+ factorSetVersion: FactorSetVersion[];
162
+
163
+ /** Array of factor values */
164
+ factorValue: FactorValue[];
165
+
166
+ /** Array of factor metadata */
167
+ factorMetaData: FactorMetaData[];
168
+
169
+ /** Array of unit conversions */
170
+ unitConversion: UnitConversion[];
171
+ }
172
+
173
+ /**
174
+ * Interface representing the emission calculation response with detailed information
175
+ */
176
+ export interface EmissionResponseWithDetails {
177
+ /** Emission calculation result */
178
+ result: EmissionResponse;
179
+
180
+ /** Detailed emission data */
181
+ data: EmissionData;
182
+ }
183
+
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Interface representing the response from the retrieve factor API
3
+ */
4
+ export interface FactorResponse {
5
+ /** Unique transaction identifier */
6
+ transactionId: string;
7
+
8
+ /** Total CO2 equivalent emissions (optional - not present in all responses)*/
9
+ totalCO2e?: number;
10
+
11
+ /** CO2 emissions value (optional - not present in all responses) */
12
+ CO2?: number;
13
+
14
+ /** CH4 (Methane) emissions value (optional - not present in all responses) */
15
+ CH4?: number;
16
+
17
+ /** N2O (Nitrous Oxide) emissions value (optional - not present in all responses) */
18
+ N2O?: number;
19
+
20
+ /** Biogenic CO2 emissions value (optional - not present in all responses) */
21
+ bioCO2?: number;
22
+
23
+ /** Indirect CO2 equivalent emissions value (optional - not present in all responses) */
24
+ indirectCO2e?: number;
25
+
26
+ /** Hydrofluorocarbon emissions value (optional - not present in all responses) */
27
+ HFC?: number;
28
+
29
+ /** Perfluorocarbon emissions value (optional - not present in all responses) */
30
+ PFC?: number;
31
+
32
+ /** Sulfur hexafluoride emissions value (optional - not present in all responses) */
33
+ SF6?: number;
34
+
35
+ /** Nitrogen trifluoride emissions value (optional - not present in all responses) */
36
+ NF3?: number;
37
+
38
+
39
+ /** Unit of measurement for emissions */
40
+ unit?: string;
41
+
42
+ /** Description of the emission factors (optional)*/
43
+ description?: string;
44
+
45
+ /** Factor set identifier (e.g., "IPCC", "IGES") */
46
+ factorSet: string;
47
+
48
+ /** Source reference for the emission factors (optional)*/
49
+ source?: string;
50
+
51
+ /** Type of activity (e.g., "Gas/Diesel Oil", "Electricity") */
52
+ activityType: string;
53
+
54
+ /** Array of supported activity units */
55
+ activityUnit: string[];
56
+
57
+ /** Name of the emission factor */
58
+ name?: string;
59
+
60
+ /** Publication start date in ISO format (optional)*/
61
+ publishedFrom?: string;
62
+
63
+ /** Publication end date in ISO format (optional) */
64
+ publishedTo?: string;
65
+
66
+ /** Effective start date in ISO format (optional) */
67
+ effectiveFrom?: string;
68
+
69
+ /** Effective end date in ISO format (optional) */
70
+ effectiveTo?: string;
71
+
72
+
73
+ /** Geographic region (e.g., "Earth", "India") */
74
+ region: string;
75
+
76
+ /** Unique factor identifier */
77
+ factorId: number;
78
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Interface for individual factor set within the response
3
+ */
4
+ export interface FactorSet {
5
+ /** Unique identifier for the factor set (required) */
6
+ id: number;
7
+
8
+ /** Name of the factor set (required) */
9
+ name: string;
10
+
11
+ /** License type for the factor set (required, e.g., "Public") */
12
+ license: string;
13
+
14
+ /** Number of factors in this set (required) */
15
+ factorCount: number;
16
+
17
+ /** Source URL for the factor set data */
18
+ sourceUrl?: string;
19
+
20
+ /** Detailed description of the factor set */
21
+ description?: string;
22
+
23
+ /** Short description of the factor set */
24
+ descriptionShort?: string;
25
+
26
+ /** Array of emission factor types included in this set */
27
+ types?: string[];
28
+
29
+ /** Array of regions/countries covered by this factor set */
30
+ regions?: string[];
31
+
32
+ /** Array of version years available for this factor set */
33
+ versions?: string[];
34
+
35
+ /** Provider/publisher of the factor set */
36
+ provider?: string;
37
+
38
+ /** Optional citation information for the factor set */
39
+ citation?: string;
40
+ }
41
+
42
+ /**
43
+ * Interface for Factor Set API response
44
+ */
45
+ export interface FactorSetResponse {
46
+ /** Transaction ID for the API request */
47
+ transactionId: string;
48
+
49
+ /** Array of factor sets returned in the response */
50
+ factorSets: FactorSet[];
51
+ }
52
+
@@ -0,0 +1,52 @@
1
+ import { FactorResponse } from './FactorResponse';
2
+
3
+ /**
4
+ * Pagination parameters for search requests
5
+ */
6
+ export interface Pagination {
7
+ /** Page number */
8
+ page: number;
9
+
10
+ /** Page size */
11
+ size: number;
12
+ }
13
+
14
+ /**
15
+ * Request body structure for pagination links
16
+ */
17
+ export interface PaginationBody {
18
+ /** Pagination parameters */
19
+ pagination?: Pagination;
20
+ }
21
+
22
+ /**
23
+ * Link object for pagination in search results
24
+ */
25
+ export interface SearchLink {
26
+ /** Relationship type (e.g., "next", "prev") */
27
+ rel: string;
28
+
29
+ /** URL for the link */
30
+ href: string;
31
+
32
+ /** Content type */
33
+ type: string;
34
+
35
+ /** HTTP method */
36
+ method: string;
37
+
38
+ /** Request body for pagination */
39
+ body?: PaginationBody;
40
+ }
41
+
42
+ /**
43
+ * Interface representing the response from the search factor API
44
+ */
45
+ export interface SearchResponse {
46
+ /** Array of factor results */
47
+ factors: FactorResponse[];
48
+
49
+ /** Pagination links (optional) */
50
+ links?: SearchLink[];
51
+ }
52
+
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Interface for type metadata API
3
+ */
4
+ export interface TypeResponse {
5
+ /** Array of string*/
6
+ types: string[];
7
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Interface for unit object
3
+ */
4
+ export interface Unit {
5
+ /** Unit symbol */
6
+ unit: string;
7
+ /** Unit name */
8
+ unitName: string;
9
+ }
10
+
11
+ /**
12
+ * Interface for /units metadata API
13
+ */
14
+ export interface UnitResponse {
15
+ /** Array of Unit objects */
16
+ units: Unit[];
17
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Interface representing the GHG Metrics Usage Response
3
+ */
4
+
5
+ export interface UsageResponse {
6
+ /** Organization ID for the API request */
7
+ orgId ?: string;
8
+
9
+ /** Array of entitlement belonging to the Org */
10
+ entitlement ?: Entitlement[]
11
+ }
12
+
13
+
14
+ export interface Entitlement {
15
+ /** Organization's billing start date*/
16
+ startDate ?: string;
17
+
18
+ /** Organization's billing end date */
19
+ endDate ?: string;
20
+
21
+ /** Total api calls made by the Organization in the billing cycle */
22
+ totalApiCalls ?: number;
23
+ }