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.
- package/README.md +9 -0
- package/dist/Constants.js +2 -1
- 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/api/Usage.js +26 -0
- package/dist/coverage/clover.xml +346 -0
- package/dist/coverage/coverage-final.json +20 -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 +214 -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/Usage.ts.html +160 -0
- package/dist/coverage/lcov-report/src/api/index.html +236 -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 +578 -0
- package/dist/index.js +2 -1
- 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/interfaces/response/UsageResponse.js +5 -0
- package/dist/types/Constants.d.ts +1 -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/api/Usage.d.ts +13 -0
- package/dist/types/index.d.ts +10 -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 +16 -0
- package/dist/types/interfaces/response/UsageResponse.d.ts +17 -0
- package/docs/_sources/index.rst.txt +1 -0
- package/docs/_sources/reference.rst.txt +6 -0
- package/docs/_sources/troubleshooting.rst.txt +486 -0
- package/docs/authentication.html +1 -0
- package/docs/client.html +1 -0
- package/docs/genindex.html +5 -0
- package/docs/getting_started.html +1 -0
- package/docs/index.html +15 -0
- package/docs/objects.inv +0 -0
- package/docs/reference.html +71 -35
- package/docs/sdk.html +1 -0
- package/docs/search.html +1 -0
- package/docs/searchindex.js +1 -1
- package/docs/troubleshooting.html +777 -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/reference.rst +6 -0
- package/sphinx-build/source/troubleshooting.rst +486 -0
- package/src/Constants.ts +2 -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/api/Usage.ts +26 -0
- package/src/index.ts +35 -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 +17 -0
- package/src/interfaces/response/UsageResponse.ts +23 -0
- package/test/apiTest.test.ts +35 -4
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { EmissionResponse } from './EmissionResponse';
|
|
2
|
+
/**
|
|
3
|
+
* Interface for unit information in emission details
|
|
4
|
+
*/
|
|
5
|
+
export interface UnitInfo {
|
|
6
|
+
/** Unit name */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Unit description (optional) */
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface for area information
|
|
13
|
+
*/
|
|
14
|
+
export interface AreaInfo {
|
|
15
|
+
/** Internal name of the area */
|
|
16
|
+
internalName: string;
|
|
17
|
+
/** Standard name of the area */
|
|
18
|
+
standardName: string;
|
|
19
|
+
alpha3?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Interface for area type information
|
|
23
|
+
*/
|
|
24
|
+
export interface AreaType {
|
|
25
|
+
/** Type name (e.g., "Planet", "State") */
|
|
26
|
+
name: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Interface for factor data type categories
|
|
30
|
+
*/
|
|
31
|
+
export interface FactorDataTypeCategory {
|
|
32
|
+
/** Category name */
|
|
33
|
+
name: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Interface for factor set information
|
|
37
|
+
*/
|
|
38
|
+
export interface FactorSetInfo {
|
|
39
|
+
/** Factor set type */
|
|
40
|
+
type: string;
|
|
41
|
+
/** Description of the factor set */
|
|
42
|
+
description?: string;
|
|
43
|
+
/** Provider of the factor set */
|
|
44
|
+
provider?: string;
|
|
45
|
+
/** Source URL for the factor set */
|
|
46
|
+
sourceUrl?: string;
|
|
47
|
+
factorSource?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface FactorSelectionDefault {
|
|
50
|
+
actorDataType?: string;
|
|
51
|
+
areaName?: string;
|
|
52
|
+
factorSetName?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Interface for factor data type code
|
|
56
|
+
*/
|
|
57
|
+
export interface FactorDataTypeCode {
|
|
58
|
+
/** Unit of measure */
|
|
59
|
+
unitOfMeasure: string;
|
|
60
|
+
/** Activity type */
|
|
61
|
+
type: string;
|
|
62
|
+
/** Activity subtype */
|
|
63
|
+
subtype: string;
|
|
64
|
+
/** Unique factor identifier */
|
|
65
|
+
factorId: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Interface for factor set version information
|
|
69
|
+
*/
|
|
70
|
+
export interface FactorSetVersion {
|
|
71
|
+
/** Publication start date */
|
|
72
|
+
publishedFrom?: string;
|
|
73
|
+
/** Publication end date (optional) */
|
|
74
|
+
publishedTo?: string;
|
|
75
|
+
/** Source of the factor */
|
|
76
|
+
factorSource: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Interface for factor value
|
|
80
|
+
*/
|
|
81
|
+
export interface FactorValue {
|
|
82
|
+
/** Unit information */
|
|
83
|
+
unit: {
|
|
84
|
+
/** Unit name */
|
|
85
|
+
name: string;
|
|
86
|
+
};
|
|
87
|
+
/** Factor value */
|
|
88
|
+
value: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Interface for factor metadata
|
|
92
|
+
*/
|
|
93
|
+
export interface FactorMetaData {
|
|
94
|
+
/** Metadata key */
|
|
95
|
+
key: string;
|
|
96
|
+
/** Metadata value */
|
|
97
|
+
value: string;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Interface for unit conversion information
|
|
101
|
+
*/
|
|
102
|
+
export interface UnitConversion {
|
|
103
|
+
/** Input unit */
|
|
104
|
+
inputUnit: string;
|
|
105
|
+
/** Unit from database */
|
|
106
|
+
unitFromDb: string;
|
|
107
|
+
/** Conversion ratio */
|
|
108
|
+
conversionRatio: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Interface for detailed emission data
|
|
112
|
+
*/
|
|
113
|
+
export interface EmissionData {
|
|
114
|
+
/** Array of unit information */
|
|
115
|
+
unit: UnitInfo[];
|
|
116
|
+
/** Array of area information */
|
|
117
|
+
area: AreaInfo[];
|
|
118
|
+
/** Array of area types */
|
|
119
|
+
areaType: AreaType[];
|
|
120
|
+
/** Array of factor data type categories */
|
|
121
|
+
factorDataTypeCategories: FactorDataTypeCategory[];
|
|
122
|
+
factorSelectionDefault?: FactorSelectionDefault[];
|
|
123
|
+
/** Array of factor set information */
|
|
124
|
+
factorSet: FactorSetInfo[];
|
|
125
|
+
/** Array of factor data type codes */
|
|
126
|
+
factorDataTypeCode: FactorDataTypeCode[];
|
|
127
|
+
/** Array of factor set versions */
|
|
128
|
+
factorSetVersion: FactorSetVersion[];
|
|
129
|
+
/** Array of factor values */
|
|
130
|
+
factorValue: FactorValue[];
|
|
131
|
+
/** Array of factor metadata */
|
|
132
|
+
factorMetaData: FactorMetaData[];
|
|
133
|
+
/** Array of unit conversions */
|
|
134
|
+
unitConversion: UnitConversion[];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Interface representing the emission calculation response with detailed information
|
|
138
|
+
*/
|
|
139
|
+
export interface EmissionResponseWithDetails {
|
|
140
|
+
/** Emission calculation result */
|
|
141
|
+
result: EmissionResponse;
|
|
142
|
+
/** Detailed emission data */
|
|
143
|
+
data: EmissionData;
|
|
144
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the response from the retrieve factor API
|
|
3
|
+
*/
|
|
4
|
+
export interface FactorResponse {
|
|
5
|
+
/** Unique transaction identifier */
|
|
6
|
+
transactionId: string;
|
|
7
|
+
/** Total CO2 equivalent emissions (optional - not present in all responses)*/
|
|
8
|
+
totalCO2e?: number;
|
|
9
|
+
/** CO2 emissions value (optional - not present in all responses) */
|
|
10
|
+
CO2?: number;
|
|
11
|
+
/** CH4 (Methane) emissions value (optional - not present in all responses) */
|
|
12
|
+
CH4?: number;
|
|
13
|
+
/** N2O (Nitrous Oxide) emissions value (optional - not present in all responses) */
|
|
14
|
+
N2O?: number;
|
|
15
|
+
/** Biogenic CO2 emissions value (optional - not present in all responses) */
|
|
16
|
+
bioCO2?: number;
|
|
17
|
+
/** Indirect CO2 equivalent emissions value (optional - not present in all responses) */
|
|
18
|
+
indirectCO2e?: number;
|
|
19
|
+
/** Hydrofluorocarbon emissions value (optional - not present in all responses) */
|
|
20
|
+
HFC?: number;
|
|
21
|
+
/** Perfluorocarbon emissions value (optional - not present in all responses) */
|
|
22
|
+
PFC?: number;
|
|
23
|
+
/** Sulfur hexafluoride emissions value (optional - not present in all responses) */
|
|
24
|
+
SF6?: number;
|
|
25
|
+
/** Nitrogen trifluoride emissions value (optional - not present in all responses) */
|
|
26
|
+
NF3?: number;
|
|
27
|
+
/** Unit of measurement for emissions */
|
|
28
|
+
unit?: string;
|
|
29
|
+
/** Description of the emission factors (optional)*/
|
|
30
|
+
description?: string;
|
|
31
|
+
/** Factor set identifier (e.g., "IPCC", "IGES") */
|
|
32
|
+
factorSet: string;
|
|
33
|
+
/** Source reference for the emission factors (optional)*/
|
|
34
|
+
source?: string;
|
|
35
|
+
/** Type of activity (e.g., "Gas/Diesel Oil", "Electricity") */
|
|
36
|
+
activityType: string;
|
|
37
|
+
/** Array of supported activity units */
|
|
38
|
+
activityUnit: string[];
|
|
39
|
+
/** Name of the emission factor */
|
|
40
|
+
name?: string;
|
|
41
|
+
/** Publication start date in ISO format (optional)*/
|
|
42
|
+
publishedFrom?: string;
|
|
43
|
+
/** Publication end date in ISO format (optional) */
|
|
44
|
+
publishedTo?: string;
|
|
45
|
+
/** Effective start date in ISO format (optional) */
|
|
46
|
+
effectiveFrom?: string;
|
|
47
|
+
/** Effective end date in ISO format (optional) */
|
|
48
|
+
effectiveTo?: string;
|
|
49
|
+
/** Geographic region (e.g., "Earth", "India") */
|
|
50
|
+
region: string;
|
|
51
|
+
/** Unique factor identifier */
|
|
52
|
+
factorId: number;
|
|
53
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
/** Name of the factor set (required) */
|
|
8
|
+
name: string;
|
|
9
|
+
/** License type for the factor set (required, e.g., "Public") */
|
|
10
|
+
license: string;
|
|
11
|
+
/** Number of factors in this set (required) */
|
|
12
|
+
factorCount: number;
|
|
13
|
+
/** Source URL for the factor set data */
|
|
14
|
+
sourceUrl?: string;
|
|
15
|
+
/** Detailed description of the factor set */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** Short description of the factor set */
|
|
18
|
+
descriptionShort?: string;
|
|
19
|
+
/** Array of emission factor types included in this set */
|
|
20
|
+
types?: string[];
|
|
21
|
+
/** Array of regions/countries covered by this factor set */
|
|
22
|
+
regions?: string[];
|
|
23
|
+
/** Array of version years available for this factor set */
|
|
24
|
+
versions?: string[];
|
|
25
|
+
/** Provider/publisher of the factor set */
|
|
26
|
+
provider?: string;
|
|
27
|
+
/** Optional citation information for the factor set */
|
|
28
|
+
citation?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Interface for Factor Set API response
|
|
32
|
+
*/
|
|
33
|
+
export interface FactorSetResponse {
|
|
34
|
+
/** Transaction ID for the API request */
|
|
35
|
+
transactionId: string;
|
|
36
|
+
/** Array of factor sets returned in the response */
|
|
37
|
+
factorSets: FactorSet[];
|
|
38
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FactorResponse } from './FactorResponse';
|
|
2
|
+
/**
|
|
3
|
+
* Pagination parameters for search requests
|
|
4
|
+
*/
|
|
5
|
+
export interface Pagination {
|
|
6
|
+
/** Page number */
|
|
7
|
+
page: number;
|
|
8
|
+
/** Page size */
|
|
9
|
+
size: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Request body structure for pagination links
|
|
13
|
+
*/
|
|
14
|
+
export interface PaginationBody {
|
|
15
|
+
/** Pagination parameters */
|
|
16
|
+
pagination?: Pagination;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Link object for pagination in search results
|
|
20
|
+
*/
|
|
21
|
+
export interface SearchLink {
|
|
22
|
+
/** Relationship type (e.g., "next", "prev") */
|
|
23
|
+
rel: string;
|
|
24
|
+
/** URL for the link */
|
|
25
|
+
href: string;
|
|
26
|
+
/** Content type */
|
|
27
|
+
type: string;
|
|
28
|
+
/** HTTP method */
|
|
29
|
+
method: string;
|
|
30
|
+
/** Request body for pagination */
|
|
31
|
+
body?: PaginationBody;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Interface representing the response from the search factor API
|
|
35
|
+
*/
|
|
36
|
+
export interface SearchResponse {
|
|
37
|
+
/** Array of factor results */
|
|
38
|
+
factors: FactorResponse[];
|
|
39
|
+
/** Pagination links (optional) */
|
|
40
|
+
links?: SearchLink[];
|
|
41
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
* Interface for /units metadata API
|
|
12
|
+
*/
|
|
13
|
+
export interface UnitResponse {
|
|
14
|
+
/** Array of Unit objects */
|
|
15
|
+
units: Unit[];
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the GHG Metrics Usage Response
|
|
3
|
+
*/
|
|
4
|
+
export interface UsageResponse {
|
|
5
|
+
/** Organization ID for the API request */
|
|
6
|
+
orgId?: string;
|
|
7
|
+
/** Array of entitlement belonging to the Org */
|
|
8
|
+
entitlement?: Entitlement[];
|
|
9
|
+
}
|
|
10
|
+
export interface Entitlement {
|
|
11
|
+
/** Organization's billing start date*/
|
|
12
|
+
startDate?: string;
|
|
13
|
+
/** Organization's billing end date */
|
|
14
|
+
endDate?: string;
|
|
15
|
+
/** Total api calls made by the Organization in the billing cycle */
|
|
16
|
+
totalApiCalls?: number;
|
|
17
|
+
}
|