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.
- package/dist/api/Calculation.js +4 -4
- package/dist/api/Factor.js +7 -7
- package/dist/api/FactorSets.js +1 -1
- package/dist/api/Fugitive.js +4 -4
- package/dist/api/Location.js +4 -4
- package/dist/api/Mobile.js +4 -6
- package/dist/api/Stationary.js +4 -4
- package/dist/api/TransportationAndDistribution.js +5 -5
- package/dist/coverage/clover.xml +335 -0
- package/dist/coverage/coverage-final.json +19 -0
- package/dist/coverage/lcov-report/base.css +224 -0
- package/dist/coverage/lcov-report/block-navigation.js +87 -0
- package/dist/coverage/lcov-report/favicon.png +0 -0
- package/dist/coverage/lcov-report/index.html +161 -0
- package/dist/coverage/lcov-report/prettify.css +1 -0
- package/dist/coverage/lcov-report/prettify.js +2 -0
- package/dist/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/dist/coverage/lcov-report/sorter.js +210 -0
- package/dist/coverage/lcov-report/src/Client.ts.html +838 -0
- package/dist/coverage/lcov-report/src/Constants.ts.html +208 -0
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +436 -0
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +622 -0
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +157 -0
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +436 -0
- package/dist/coverage/lcov-report/src/api/Location.ts.html +433 -0
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +448 -0
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +442 -0
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +436 -0
- package/dist/coverage/lcov-report/src/api/index.html +221 -0
- package/dist/coverage/lcov-report/src/index.html +161 -0
- package/dist/coverage/lcov-report/src/request.ts.html +235 -0
- package/dist/coverage/lcov-report/src/utils.ts.html +139 -0
- package/dist/coverage/lcov-report/test/index.html +116 -0
- package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +142 -0
- package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +133 -0
- package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +142 -0
- package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +139 -0
- package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +142 -0
- package/dist/coverage/lcov-report/test/mocks/index.html +176 -0
- package/dist/coverage/lcov-report/test/testUtils.ts.html +97 -0
- package/dist/coverage/lcov.info +558 -0
- package/dist/interfaces/response/AreaResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponse.js +2 -0
- package/dist/interfaces/response/EmissionResponseWithDetails.js +2 -0
- package/dist/interfaces/response/FactorResponse.js +2 -0
- package/dist/interfaces/response/FactorSetResponse.js +2 -0
- package/dist/interfaces/response/SearchResponse.js +2 -0
- package/dist/interfaces/response/TypeResponse.js +2 -0
- package/dist/interfaces/response/UnitResponse.js +2 -0
- package/dist/types/api/Calculation.d.ts +13 -8
- package/dist/types/api/Factor.d.ts +18 -13
- package/dist/types/api/FactorSets.d.ts +3 -2
- package/dist/types/api/Fugitive.d.ts +13 -8
- package/dist/types/api/Location.d.ts +13 -8
- package/dist/types/api/Mobile.d.ts +13 -10
- package/dist/types/api/Stationary.d.ts +13 -8
- package/dist/types/api/TransportationAndDistribution.d.ts +14 -9
- package/dist/types/index.d.ts +8 -0
- package/dist/types/interfaces/response/AreaResponse.d.ts +20 -0
- package/dist/types/interfaces/response/EmissionResponse.d.ts +31 -0
- package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +144 -0
- package/dist/types/interfaces/response/FactorResponse.d.ts +53 -0
- package/dist/types/interfaces/response/FactorSetResponse.d.ts +38 -0
- package/dist/types/interfaces/response/SearchResponse.d.ts +41 -0
- package/dist/types/interfaces/response/TypeResponse.d.ts +7 -0
- package/dist/types/interfaces/response/UnitResponse.d.ts +7 -0
- package/docs/_sources/index.rst.txt +1 -0
- package/docs/_sources/troubleshooting.rst.txt +486 -0
- package/docs/_static/basic.css +8 -0
- package/docs/_static/pygments.css +146 -164
- package/docs/_static/searchtools.js +5 -8
- package/docs/_static/styles/furo.css +1 -1
- package/docs/_static/styles/furo.css.map +1 -1
- package/docs/authentication.html +29 -19
- package/docs/client.html +29 -19
- package/docs/genindex.html +29 -19
- package/docs/getting_started.html +29 -19
- package/docs/index.html +42 -19
- package/docs/objects.inv +0 -0
- package/docs/reference.html +69 -53
- package/docs/sdk.html +29 -19
- package/docs/search.html +29 -19
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +786 -0
- package/package.json +1 -1
- package/sphinx-build/requirements.txt +5 -0
- package/sphinx-build/source/index.rst +1 -0
- package/sphinx-build/source/troubleshooting.rst +486 -0
- package/src/api/Calculation.ts +19 -14
- package/src/api/Factor.ts +27 -22
- package/src/api/FactorSets.ts +4 -3
- package/src/api/Fugitive.ts +19 -14
- package/src/api/Location.ts +20 -15
- package/src/api/Mobile.ts +19 -16
- package/src/api/Stationary.ts +19 -14
- package/src/api/TransportationAndDistribution.ts +21 -16
- package/src/index.ts +33 -1
- package/src/interfaces/response/AreaResponse.ts +25 -0
- package/src/interfaces/response/EmissionResponse.ts +44 -0
- package/src/interfaces/response/EmissionResponseWithDetails.ts +183 -0
- package/src/interfaces/response/FactorResponse.ts +78 -0
- package/src/interfaces/response/FactorSetResponse.ts +52 -0
- package/src/interfaces/response/SearchResponse.ts +52 -0
- package/src/interfaces/response/TypeResponse.ts +7 -0
- package/src/interfaces/response/UnitResponse.ts +7 -0
- package/test/apiTest.test.ts +1 -1
|
@@ -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
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
113
|
+
return makeApiRequest<UnitResponse>({
|
|
109
114
|
method: GET,
|
|
110
115
|
url,
|
|
111
116
|
params : { type }
|
package/src/index.ts
CHANGED
|
@@ -7,4 +7,36 @@ export * as Calculation from './api/Calculation';
|
|
|
7
7
|
export * as TransportationAndDistribution from './api/TransportationAndDistribution';
|
|
8
8
|
export * as Factor from './api/Factor';
|
|
9
9
|
export * as FactorSets from './api/FactorSets'
|
|
10
|
-
export { ClientConfig } from './interfaces/Config';
|
|
10
|
+
export { ClientConfig } from './interfaces/Config';
|
|
11
|
+
|
|
12
|
+
// Response interfaces
|
|
13
|
+
export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
|
|
14
|
+
export { EmissionResponse } from './interfaces/response/EmissionResponse';
|
|
15
|
+
export {
|
|
16
|
+
EmissionResponseWithDetails,
|
|
17
|
+
UnitInfo,
|
|
18
|
+
AreaInfo,
|
|
19
|
+
AreaType,
|
|
20
|
+
FactorDataTypeCategory,
|
|
21
|
+
FactorSetInfo,
|
|
22
|
+
FactorSelectionDefault,
|
|
23
|
+
FactorDataTypeCode,
|
|
24
|
+
FactorSetVersion,
|
|
25
|
+
FactorValue,
|
|
26
|
+
FactorMetaData,
|
|
27
|
+
UnitConversion,
|
|
28
|
+
EmissionData
|
|
29
|
+
} from './interfaces/response/EmissionResponseWithDetails';
|
|
30
|
+
export { FactorResponse } from './interfaces/response/FactorResponse';
|
|
31
|
+
export {
|
|
32
|
+
FactorSetResponse,
|
|
33
|
+
FactorSet
|
|
34
|
+
} from './interfaces/response/FactorSetResponse';
|
|
35
|
+
export {
|
|
36
|
+
SearchResponse,
|
|
37
|
+
Pagination,
|
|
38
|
+
PaginationBody,
|
|
39
|
+
SearchLink
|
|
40
|
+
} from './interfaces/response/SearchResponse';
|
|
41
|
+
export { TypeResponse } from './interfaces/response/TypeResponse';
|
|
42
|
+
export { UnitResponse } from './interfaces/response/UnitResponse';
|
|
@@ -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
|
+
|
package/test/apiTest.test.ts
CHANGED