emissions-api-sdk 1.0.8 → 1.0.10
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/Client.js +69 -9
- package/dist/Constants.js +2 -1
- package/dist/coverage/clover.xml +72 -57
- package/dist/coverage/coverage-final.json +4 -4
- package/dist/coverage/lcov-report/index.html +18 -18
- package/dist/coverage/lcov-report/src/Client.ts.html +242 -50
- package/dist/coverage/lcov-report/src/Constants.ts.html +7 -4
- package/dist/coverage/lcov-report/src/api/Calculation.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Factor.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Location.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Metadata.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Mobile.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Stationary.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/TypeRecommender.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
- package/dist/coverage/lcov-report/src/api/index.html +1 -1
- package/dist/coverage/lcov-report/src/index.html +21 -21
- package/dist/coverage/lcov-report/src/request.ts.html +1 -1
- package/dist/coverage/lcov-report/src/utils.ts.html +5 -5
- package/dist/coverage/lcov-report/test/index.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
- package/dist/coverage/lcov-report/test/mocks/index.html +1 -1
- package/dist/coverage/lcov-report/test/testUtils.ts.html +4 -4
- package/dist/coverage/lcov.info +161 -121
- package/dist/types/Client.d.ts +26 -0
- package/dist/types/Constants.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/Config.d.ts +6 -0
- package/dist/types/interfaces/response/EmissionResponseWithDetails.d.ts +62 -124
- package/docs/reference.html +8 -2
- package/docs/searchindex.js +1 -1
- package/package.json +3 -2
- package/src/Client.ts +79 -15
- package/src/Constants.ts +1 -0
- package/src/index.ts +3 -12
- package/src/interfaces/Config.ts +7 -0
- package/src/interfaces/response/EmissionResponseWithDetails.ts +79 -146
- package/test/client.test.ts +93 -1
- package/test/tokenRefresh.test.ts +91 -1
- package/.secrets.baseline +0 -314
package/dist/coverage/lcov.info
CHANGED
|
@@ -1,123 +1,162 @@
|
|
|
1
1
|
TN:
|
|
2
2
|
SF:src/Client.ts
|
|
3
|
-
FN:
|
|
4
|
-
FN:
|
|
5
|
-
FN:
|
|
6
|
-
FN:
|
|
7
|
-
FN:
|
|
8
|
-
FN:
|
|
9
|
-
FN:
|
|
10
|
-
FN:
|
|
11
|
-
FN:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
FNDA:
|
|
3
|
+
FN:20,(anonymous_1)
|
|
4
|
+
FN:87,(anonymous_2)
|
|
5
|
+
FN:137,(anonymous_3)
|
|
6
|
+
FN:159,(anonymous_4)
|
|
7
|
+
FN:180,(anonymous_5)
|
|
8
|
+
FN:219,(anonymous_6)
|
|
9
|
+
FN:233,(anonymous_7)
|
|
10
|
+
FN:247,(anonymous_8)
|
|
11
|
+
FN:269,(anonymous_9)
|
|
12
|
+
FN:303,(anonymous_10)
|
|
13
|
+
FNF:10
|
|
14
|
+
FNH:8
|
|
15
|
+
FNDA:43,(anonymous_1)
|
|
16
|
+
FNDA:48,(anonymous_2)
|
|
16
17
|
FNDA:66,(anonymous_3)
|
|
17
|
-
FNDA:
|
|
18
|
-
FNDA:
|
|
19
|
-
FNDA:
|
|
18
|
+
FNDA:77,(anonymous_4)
|
|
19
|
+
FNDA:6,(anonymous_5)
|
|
20
|
+
FNDA:4,(anonymous_6)
|
|
20
21
|
FNDA:0,(anonymous_7)
|
|
21
22
|
FNDA:0,(anonymous_8)
|
|
22
23
|
FNDA:4,(anonymous_9)
|
|
24
|
+
FNDA:8,(anonymous_10)
|
|
23
25
|
DA:1,5
|
|
24
26
|
DA:3,5
|
|
25
27
|
DA:4,5
|
|
26
28
|
DA:6,5
|
|
27
29
|
DA:7,5
|
|
28
|
-
DA:
|
|
29
|
-
DA:
|
|
30
|
-
DA:
|
|
31
|
-
DA:
|
|
32
|
-
DA:28,1
|
|
30
|
+
DA:25,43
|
|
31
|
+
DA:26,43
|
|
32
|
+
DA:27,43
|
|
33
|
+
DA:28,43
|
|
33
34
|
DA:29,1
|
|
34
|
-
DA:
|
|
35
|
-
DA:
|
|
36
|
-
DA:
|
|
37
|
-
DA:
|
|
38
|
-
DA:
|
|
39
|
-
DA:38,
|
|
40
|
-
DA:39,
|
|
41
|
-
DA:40,
|
|
42
|
-
DA:
|
|
43
|
-
DA:
|
|
44
|
-
DA:
|
|
45
|
-
DA:
|
|
46
|
-
DA:88,38
|
|
35
|
+
DA:30,1
|
|
36
|
+
DA:31,1
|
|
37
|
+
DA:33,42
|
|
38
|
+
DA:34,42
|
|
39
|
+
DA:35,42
|
|
40
|
+
DA:38,43
|
|
41
|
+
DA:39,43
|
|
42
|
+
DA:40,43
|
|
43
|
+
DA:41,43
|
|
44
|
+
DA:42,43
|
|
45
|
+
DA:43,43
|
|
46
|
+
DA:88,48
|
|
47
47
|
DA:89,1
|
|
48
|
-
DA:
|
|
49
|
-
DA:
|
|
50
|
-
DA:
|
|
51
|
-
DA:
|
|
52
|
-
DA:
|
|
53
|
-
DA:
|
|
54
|
-
DA:
|
|
55
|
-
DA:
|
|
56
|
-
DA:
|
|
57
|
-
DA:
|
|
58
|
-
DA:
|
|
59
|
-
DA:
|
|
60
|
-
DA:
|
|
61
|
-
DA:
|
|
48
|
+
DA:93,47
|
|
49
|
+
DA:94,1
|
|
50
|
+
DA:98,46
|
|
51
|
+
DA:99,1
|
|
52
|
+
DA:103,45
|
|
53
|
+
DA:104,1
|
|
54
|
+
DA:108,44
|
|
55
|
+
DA:109,1
|
|
56
|
+
DA:114,43
|
|
57
|
+
DA:116,43
|
|
58
|
+
DA:117,1
|
|
59
|
+
DA:118,1
|
|
60
|
+
DA:119,42
|
|
61
|
+
DA:120,6
|
|
62
|
+
DA:122,36
|
|
63
|
+
DA:124,43
|
|
64
|
+
DA:138,66
|
|
65
|
+
DA:160,77
|
|
62
66
|
DA:161,1
|
|
63
|
-
DA:
|
|
64
|
-
DA:
|
|
67
|
+
DA:165,76
|
|
68
|
+
DA:181,6
|
|
69
|
+
DA:182,5
|
|
70
|
+
DA:183,5
|
|
71
|
+
DA:184,3
|
|
72
|
+
DA:186,3
|
|
65
73
|
DA:187,2
|
|
66
|
-
DA:
|
|
67
|
-
DA:
|
|
68
|
-
DA:
|
|
69
|
-
DA:
|
|
70
|
-
DA:
|
|
71
|
-
DA:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
BRDA:
|
|
83
|
-
BRDA:
|
|
84
|
-
BRDA:
|
|
85
|
-
BRDA:
|
|
86
|
-
BRDA:
|
|
87
|
-
BRDA:
|
|
88
|
-
BRDA:
|
|
89
|
-
BRDA:40,
|
|
90
|
-
BRDA:
|
|
91
|
-
BRDA:
|
|
92
|
-
BRDA:
|
|
93
|
-
BRDA:
|
|
94
|
-
BRDA:
|
|
95
|
-
BRDA:
|
|
96
|
-
BRDA:
|
|
97
|
-
BRDA:
|
|
98
|
-
BRDA:
|
|
99
|
-
BRDA:
|
|
100
|
-
BRDA:
|
|
101
|
-
BRDA:88,
|
|
102
|
-
BRDA:88,
|
|
103
|
-
BRDA:
|
|
104
|
-
BRDA:
|
|
105
|
-
BRDA:
|
|
106
|
-
BRDA:
|
|
107
|
-
BRDA:
|
|
108
|
-
BRDA:
|
|
109
|
-
BRDA:
|
|
110
|
-
BRDA:
|
|
111
|
-
BRDA:
|
|
112
|
-
BRDA:
|
|
113
|
-
BRDA:
|
|
114
|
-
BRDA:
|
|
115
|
-
BRDA:
|
|
116
|
-
BRDA:
|
|
117
|
-
BRDA:
|
|
118
|
-
BRDA:
|
|
119
|
-
|
|
120
|
-
|
|
74
|
+
DA:193,1
|
|
75
|
+
DA:200,3
|
|
76
|
+
DA:201,3
|
|
77
|
+
DA:220,4
|
|
78
|
+
DA:234,0
|
|
79
|
+
DA:248,0
|
|
80
|
+
DA:270,4
|
|
81
|
+
DA:271,4
|
|
82
|
+
DA:282,4
|
|
83
|
+
DA:283,4
|
|
84
|
+
DA:304,8
|
|
85
|
+
DA:305,8
|
|
86
|
+
DA:313,8
|
|
87
|
+
DA:314,8
|
|
88
|
+
LF:63
|
|
89
|
+
LH:61
|
|
90
|
+
BRDA:23,0,0,0
|
|
91
|
+
BRDA:25,1,0,7
|
|
92
|
+
BRDA:25,2,0,37
|
|
93
|
+
BRDA:25,3,0,7
|
|
94
|
+
BRDA:25,4,0,43
|
|
95
|
+
BRDA:28,5,0,1
|
|
96
|
+
BRDA:28,5,1,42
|
|
97
|
+
BRDA:40,6,0,0
|
|
98
|
+
BRDA:40,6,1,43
|
|
99
|
+
BRDA:40,7,0,43
|
|
100
|
+
BRDA:40,7,1,43
|
|
101
|
+
BRDA:41,8,0,2
|
|
102
|
+
BRDA:41,8,1,41
|
|
103
|
+
BRDA:41,9,0,43
|
|
104
|
+
BRDA:41,9,1,43
|
|
105
|
+
BRDA:41,10,0,4
|
|
106
|
+
BRDA:41,10,1,37
|
|
107
|
+
BRDA:43,11,0,0
|
|
108
|
+
BRDA:43,11,1,43
|
|
109
|
+
BRDA:88,12,0,1
|
|
110
|
+
BRDA:88,12,1,47
|
|
111
|
+
BRDA:88,13,0,48
|
|
112
|
+
BRDA:88,13,1,1
|
|
113
|
+
BRDA:93,14,0,1
|
|
114
|
+
BRDA:93,14,1,46
|
|
115
|
+
BRDA:93,15,0,47
|
|
116
|
+
BRDA:93,15,1,2
|
|
117
|
+
BRDA:98,16,0,1
|
|
118
|
+
BRDA:98,16,1,45
|
|
119
|
+
BRDA:98,17,0,46
|
|
120
|
+
BRDA:98,17,1,37
|
|
121
|
+
BRDA:98,17,2,36
|
|
122
|
+
BRDA:103,18,0,1
|
|
123
|
+
BRDA:103,18,1,44
|
|
124
|
+
BRDA:103,19,0,45
|
|
125
|
+
BRDA:103,19,1,8
|
|
126
|
+
BRDA:108,20,0,1
|
|
127
|
+
BRDA:108,20,1,43
|
|
128
|
+
BRDA:108,21,0,44
|
|
129
|
+
BRDA:108,21,1,7
|
|
130
|
+
BRDA:116,22,0,1
|
|
131
|
+
BRDA:116,22,1,42
|
|
132
|
+
BRDA:116,23,0,43
|
|
133
|
+
BRDA:116,23,1,1
|
|
134
|
+
BRDA:119,24,0,6
|
|
135
|
+
BRDA:119,24,1,36
|
|
136
|
+
BRDA:119,25,0,42
|
|
137
|
+
BRDA:119,25,1,6
|
|
138
|
+
BRDA:160,26,0,1
|
|
139
|
+
BRDA:160,26,1,76
|
|
140
|
+
BRDA:181,27,0,5
|
|
141
|
+
BRDA:181,27,1,1
|
|
142
|
+
BRDA:183,28,0,3
|
|
143
|
+
BRDA:183,28,1,2
|
|
144
|
+
BRDA:186,29,0,2
|
|
145
|
+
BRDA:186,29,1,1
|
|
146
|
+
BRDA:270,30,0,1
|
|
147
|
+
BRDA:270,30,1,3
|
|
148
|
+
BRDA:270,31,0,4
|
|
149
|
+
BRDA:270,31,1,4
|
|
150
|
+
BRDA:282,32,0,0
|
|
151
|
+
BRDA:282,32,1,4
|
|
152
|
+
BRDA:304,33,0,4
|
|
153
|
+
BRDA:304,33,1,4
|
|
154
|
+
BRDA:304,34,0,8
|
|
155
|
+
BRDA:304,34,1,8
|
|
156
|
+
BRDA:313,35,0,0
|
|
157
|
+
BRDA:313,35,1,8
|
|
158
|
+
BRF:68
|
|
159
|
+
BRH:63
|
|
121
160
|
end_of_record
|
|
122
161
|
TN:
|
|
123
162
|
SF:src/Constants.ts
|
|
@@ -136,18 +175,19 @@ DA:10,5
|
|
|
136
175
|
DA:11,5
|
|
137
176
|
DA:12,5
|
|
138
177
|
DA:13,5
|
|
139
|
-
DA:
|
|
140
|
-
DA:
|
|
141
|
-
DA:
|
|
178
|
+
DA:14,5
|
|
179
|
+
DA:16,5
|
|
180
|
+
DA:18,5
|
|
142
181
|
DA:20,5
|
|
143
182
|
DA:21,5
|
|
144
|
-
DA:
|
|
183
|
+
DA:22,5
|
|
145
184
|
DA:24,5
|
|
146
185
|
DA:25,5
|
|
147
186
|
DA:26,5
|
|
148
187
|
DA:27,5
|
|
149
|
-
|
|
150
|
-
|
|
188
|
+
DA:28,5
|
|
189
|
+
LF:24
|
|
190
|
+
LH:24
|
|
151
191
|
BRF:0
|
|
152
192
|
BRH:0
|
|
153
193
|
end_of_record
|
|
@@ -176,16 +216,16 @@ SF:src/utils.ts
|
|
|
176
216
|
FN:14,findExpiryTime
|
|
177
217
|
FNF:1
|
|
178
218
|
FNH:1
|
|
179
|
-
FNDA:
|
|
219
|
+
FNDA:38,findExpiryTime
|
|
180
220
|
DA:14,5
|
|
181
|
-
DA:15,
|
|
182
|
-
DA:16,
|
|
183
|
-
DA:17,
|
|
184
|
-
DA:18,
|
|
221
|
+
DA:15,38
|
|
222
|
+
DA:16,38
|
|
223
|
+
DA:17,38
|
|
224
|
+
DA:18,38
|
|
185
225
|
LF:5
|
|
186
226
|
LH:5
|
|
187
227
|
BRDA:17,0,0,0
|
|
188
|
-
BRDA:17,0,1,
|
|
228
|
+
BRDA:17,0,1,38
|
|
189
229
|
BRF:2
|
|
190
230
|
BRH:1
|
|
191
231
|
end_of_record
|
|
@@ -477,11 +517,11 @@ SF:test/testUtils.ts
|
|
|
477
517
|
FN:1,generateMockjwt
|
|
478
518
|
FNF:1
|
|
479
519
|
FNH:1
|
|
480
|
-
FNDA:
|
|
520
|
+
FNDA:8,generateMockjwt
|
|
481
521
|
DA:1,1
|
|
482
|
-
DA:2,
|
|
483
|
-
DA:3,
|
|
484
|
-
DA:4,
|
|
522
|
+
DA:2,8
|
|
523
|
+
DA:3,8
|
|
524
|
+
DA:4,8
|
|
485
525
|
LF:4
|
|
486
526
|
LH:4
|
|
487
527
|
BRF:0
|
package/dist/types/Client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare class Client {
|
|
|
3
3
|
private static instance;
|
|
4
4
|
private token;
|
|
5
5
|
private readonly apiKey;
|
|
6
|
+
private readonly patToken;
|
|
6
7
|
private readonly clientId;
|
|
7
8
|
private readonly orgId;
|
|
8
9
|
private expiresAt;
|
|
@@ -21,6 +22,7 @@ export declare class Client {
|
|
|
21
22
|
* - custom "host" is provided without "authUrl"
|
|
22
23
|
* - token is provided without "clientId"
|
|
23
24
|
* - apiKey is provided without "clientId" or "orgId"
|
|
25
|
+
* - patToken is provided without "clientId" or with "orgId"
|
|
24
26
|
*
|
|
25
27
|
* @example
|
|
26
28
|
* // Initialize with authentication URL
|
|
@@ -43,6 +45,12 @@ export declare class Client {
|
|
|
43
45
|
* clientId: 'client123',
|
|
44
46
|
* orgId: 'org456'
|
|
45
47
|
* });
|
|
48
|
+
*
|
|
49
|
+
* // Initialize with PAT token
|
|
50
|
+
* await Client.getClient({
|
|
51
|
+
* patToken: 'your-personal-access-token',
|
|
52
|
+
* clientId: 'client123'
|
|
53
|
+
* });
|
|
46
54
|
*/
|
|
47
55
|
static getClient(config: ClientConfig): Promise<void>;
|
|
48
56
|
/**
|
|
@@ -143,4 +151,22 @@ export declare class Client {
|
|
|
143
151
|
* });
|
|
144
152
|
*/
|
|
145
153
|
private static requestToken;
|
|
154
|
+
/**
|
|
155
|
+
* Requests an authentication token by exchanging a Personal Access Token (PAT).
|
|
156
|
+
*
|
|
157
|
+
* @private
|
|
158
|
+
* @static
|
|
159
|
+
* @param {ClientConfig} config - The client configuration containing PAT and client details
|
|
160
|
+
* @return {Promise<string>} A promise that resolves to the authentication token string
|
|
161
|
+
* @throws {Error} Throws an error if the token response is empty
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* // Internal usage within the Client class
|
|
165
|
+
* const token = await Client.requestTokenFromPAT({
|
|
166
|
+
* patToken: 'your-personal-access-token',
|
|
167
|
+
* clientId: 'client123',
|
|
168
|
+
* authUrl: 'https://custom-auth.example.com/exchange'
|
|
169
|
+
* });
|
|
170
|
+
*/
|
|
171
|
+
private static requestTokenFromPAT;
|
|
146
172
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const API_DOMAIN = "https://api.ibm.com/ghgemissions/run";
|
|
2
2
|
export declare const TOKEN_GENERATION_API = "https://api.ibm.com/saascore/run/authentication-retrieve/api-key";
|
|
3
|
+
export declare const PAT_TOKEN_EXCHANGE_API = "https://api.ibm.com/saascore/run/envizi-auth/exchange";
|
|
3
4
|
export declare const MOBILE_API_PATH = "/v3/carbon/mobile";
|
|
4
5
|
export declare const LOCATION_API_PATH = "/v3/carbon/location";
|
|
5
6
|
export declare const FUGITIVE_API_PATH = "/v3/carbon/fugitive";
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export * as TypeRecommender from './api/TypeRecommender';
|
|
|
15
15
|
export { ClientConfig } from './interfaces/Config';
|
|
16
16
|
export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
|
|
17
17
|
export { EmissionResponse } from './interfaces/response/EmissionResponse';
|
|
18
|
-
export { EmissionResponseWithDetails,
|
|
18
|
+
export { EmissionResponseWithDetails, FactorDetails, FactorSetDetails, IncludeDetails } from './interfaces/response/EmissionResponseWithDetails';
|
|
19
19
|
export { FactorResponse } from './interfaces/response/FactorResponse';
|
|
20
20
|
export { FactorSetResponse, FactorSet } from './interfaces/response/FactorSetResponse';
|
|
21
21
|
export { SearchResponse, Pagination, PaginationBody, SearchLink } from './interfaces/response/SearchResponse';
|
|
@@ -58,6 +58,12 @@ export interface ClientConfig {
|
|
|
58
58
|
* If provided, it will be used instead of requesting a new token.
|
|
59
59
|
*/
|
|
60
60
|
token?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Optional Personal Access Token (PAT) for authentication.
|
|
63
|
+
* If provided, it will be exchanged for a JWT token.
|
|
64
|
+
* Requires clientId to be provided.
|
|
65
|
+
*/
|
|
66
|
+
patToken?: string;
|
|
61
67
|
/**
|
|
62
68
|
* Optional flag indicating whether the client is running as an Excel Add-In.
|
|
63
69
|
* This may affect certain behaviors like authentication flows.
|
|
@@ -1,148 +1,86 @@
|
|
|
1
1
|
import { EmissionResponse } from './EmissionResponse';
|
|
2
2
|
/**
|
|
3
|
-
* Interface for
|
|
3
|
+
* Interface for factor set details
|
|
4
4
|
*/
|
|
5
|
-
export interface
|
|
6
|
-
/**
|
|
7
|
-
name
|
|
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;
|
|
5
|
+
export interface FactorSetDetails {
|
|
6
|
+
/** Name of the factor set */
|
|
7
|
+
name?: string;
|
|
41
8
|
/** Description of the factor set */
|
|
42
9
|
description?: string;
|
|
43
10
|
/** Provider of the factor set */
|
|
44
11
|
provider?: string;
|
|
45
12
|
/** Source URL for the factor set */
|
|
46
13
|
sourceUrl?: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export interface FactorSelectionDefault {
|
|
50
|
-
actorDataType?: string;
|
|
51
|
-
areaName?: string;
|
|
52
|
-
factorSetName?: string;
|
|
14
|
+
/** Citation information for the factor set */
|
|
15
|
+
citation?: string;
|
|
53
16
|
}
|
|
54
17
|
/**
|
|
55
|
-
* Interface for factor
|
|
18
|
+
* Interface for factor details
|
|
56
19
|
*/
|
|
57
|
-
export interface
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
|
|
20
|
+
export interface FactorDetails {
|
|
21
|
+
/** Name of the factor */
|
|
22
|
+
name?: string;
|
|
23
|
+
/** Description of the factor */
|
|
24
|
+
description?: string;
|
|
25
|
+
/** Total CO2 equivalent emissions */
|
|
26
|
+
totalCO2e?: number;
|
|
27
|
+
/** CO2 emissions value */
|
|
28
|
+
CO2?: number;
|
|
29
|
+
/** CH4 (Methane) emissions value */
|
|
30
|
+
CH4?: number;
|
|
31
|
+
/** N2O (Nitrous Oxide) emissions value */
|
|
32
|
+
N2O?: number;
|
|
33
|
+
/** Biogenic CO2 emissions value */
|
|
34
|
+
bioCO2?: number;
|
|
35
|
+
/** Indirect CO2 equivalent emissions value */
|
|
36
|
+
indirectCO2e?: number;
|
|
37
|
+
/** Hydrofluorocarbon emissions value */
|
|
38
|
+
HFC?: number;
|
|
39
|
+
/** Perfluorocarbon emissions value */
|
|
40
|
+
PFC?: number;
|
|
41
|
+
/** Sulfur hexafluoride emissions value */
|
|
42
|
+
SF6?: number;
|
|
43
|
+
/** Nitrogen trifluoride emissions value */
|
|
44
|
+
NF3?: number;
|
|
45
|
+
/** Energy consumption in megawatt-hours */
|
|
46
|
+
'energy(MWh)'?: number;
|
|
47
|
+
/** Input unit of measurement */
|
|
48
|
+
inputUnit?: string;
|
|
49
|
+
/** Unit of measurement for emissions */
|
|
50
|
+
unit?: string;
|
|
51
|
+
/** Conversion ratio */
|
|
52
|
+
conversionRatio?: string;
|
|
53
|
+
/** Type of activity */
|
|
54
|
+
activityType?: string;
|
|
62
55
|
/** Activity subtype */
|
|
63
|
-
|
|
56
|
+
activitySubtype?: string;
|
|
64
57
|
/** Unique factor identifier */
|
|
65
|
-
factorId
|
|
66
|
-
/** activity based or spend based */
|
|
67
|
-
methodology
|
|
68
|
-
/**
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export interface FactorSetVersion {
|
|
58
|
+
factorId?: number;
|
|
59
|
+
/** Methodology (activity based or spend based) */
|
|
60
|
+
methodology?: string;
|
|
61
|
+
/** Scopes data belongs to */
|
|
62
|
+
scopes?: string[];
|
|
63
|
+
/** Area name */
|
|
64
|
+
areaName?: string;
|
|
65
|
+
/** Area type */
|
|
66
|
+
areaType?: string;
|
|
75
67
|
/** Publication start date */
|
|
76
68
|
publishedFrom?: string;
|
|
77
|
-
/** Publication end date
|
|
69
|
+
/** Publication end date */
|
|
78
70
|
publishedTo?: string;
|
|
79
71
|
/** Source of the factor */
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Interface for factor value
|
|
84
|
-
*/
|
|
85
|
-
export interface FactorValue {
|
|
86
|
-
/** Unit information */
|
|
87
|
-
unit: {
|
|
88
|
-
/** Unit name */
|
|
89
|
-
name: string;
|
|
90
|
-
};
|
|
91
|
-
/** Factor value */
|
|
92
|
-
value: number;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Interface for factor metadata
|
|
96
|
-
*/
|
|
97
|
-
export interface FactorMetaData {
|
|
98
|
-
/** Metadata key */
|
|
99
|
-
key: string;
|
|
100
|
-
/** Metadata value */
|
|
101
|
-
value: string;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Interface for unit conversion information
|
|
105
|
-
*/
|
|
106
|
-
export interface UnitConversion {
|
|
107
|
-
/** Input unit */
|
|
108
|
-
inputUnit: string;
|
|
109
|
-
/** Unit from database */
|
|
110
|
-
unitFromDb: string;
|
|
111
|
-
/** Conversion ratio */
|
|
112
|
-
conversionRatio: string;
|
|
72
|
+
source?: string;
|
|
113
73
|
}
|
|
114
74
|
/**
|
|
115
|
-
* Interface for
|
|
75
|
+
* Interface for include details
|
|
116
76
|
*/
|
|
117
|
-
export interface
|
|
118
|
-
/**
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
|
|
122
|
-
/** Array of area types */
|
|
123
|
-
areaType: AreaType[];
|
|
124
|
-
/** Array of factor data type categories */
|
|
125
|
-
factorDataTypeCategories: FactorDataTypeCategory[];
|
|
126
|
-
factorSelectionDefault?: FactorSelectionDefault[];
|
|
127
|
-
/** Array of factor set information */
|
|
128
|
-
factorSet: FactorSetInfo[];
|
|
129
|
-
/** Array of factor data type codes */
|
|
130
|
-
factorDataTypeCode: FactorDataTypeCode[];
|
|
131
|
-
/** Array of factor set versions */
|
|
132
|
-
factorSetVersion: FactorSetVersion[];
|
|
133
|
-
/** Array of factor values */
|
|
134
|
-
factorValue: FactorValue[];
|
|
135
|
-
/** Array of factor metadata */
|
|
136
|
-
factorMetaData: FactorMetaData[];
|
|
137
|
-
/** Array of unit conversions */
|
|
138
|
-
unitConversion: UnitConversion[];
|
|
77
|
+
export interface IncludeDetails {
|
|
78
|
+
/** Factor set details */
|
|
79
|
+
factorSet?: FactorSetDetails;
|
|
80
|
+
/** Factor details */
|
|
81
|
+
factor?: FactorDetails;
|
|
139
82
|
}
|
|
140
|
-
|
|
141
|
-
* Interface representing the emission calculation response with detailed information
|
|
142
|
-
*/
|
|
143
|
-
export interface EmissionResponseWithDetails {
|
|
144
|
-
/** Emission calculation result */
|
|
145
|
-
result: EmissionResponse;
|
|
83
|
+
export interface EmissionResponseWithDetails extends EmissionResponse {
|
|
146
84
|
/** Detailed emission data */
|
|
147
|
-
|
|
85
|
+
details?: IncludeDetails;
|
|
148
86
|
}
|
package/docs/reference.html
CHANGED
|
@@ -400,6 +400,12 @@ Only refreshes if the token was not provided by the user and is expiring within
|
|
|
400
400
|
<span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s1">'client123'</span><span class="p">,</span>
|
|
401
401
|
<span class="w"> </span><span class="nx">orgId</span><span class="o">:</span><span class="w"> </span><span class="s1">'org456'</span>
|
|
402
402
|
<span class="p">});</span>
|
|
403
|
+
|
|
404
|
+
<span class="c1">// Initialize with PAT token</span>
|
|
405
|
+
<span class="k">await</span><span class="w"> </span><span class="nx">Client</span><span class="p">.</span><span class="nx">getClient</span><span class="p">({</span>
|
|
406
|
+
<span class="w"> </span><span class="nx">patToken</span><span class="o">:</span><span class="w"> </span><span class="s1">'your-personal-access-token'</span><span class="p">,</span>
|
|
407
|
+
<span class="w"> </span><span class="nx">clientId</span><span class="o">:</span><span class="w"> </span><span class="s1">'client123'</span>
|
|
408
|
+
<span class="p">});</span>
|
|
403
409
|
</pre></div>
|
|
404
410
|
</div>
|
|
405
411
|
</div>
|
|
@@ -838,8 +844,8 @@ Only refreshes if the token was not provided by the user and is expiring within
|
|
|
838
844
|
<li><p><strong>getUnits/postUnits</strong>: Accept an optional <code class="docutils literal notranslate"><span class="pre">type</span></code> parameter to query units for specific emission types</p></li>
|
|
839
845
|
</ul>
|
|
840
846
|
<p><strong>Supported endpoints</strong> (for getTypes/postTypes and getArea/postArea): <code class="docutils literal notranslate"><span class="pre">calculation</span></code>, <code class="docutils literal notranslate"><span class="pre">location</span></code>, <code class="docutils literal notranslate"><span class="pre">stationary</span></code>, <code class="docutils literal notranslate"><span class="pre">mobile</span></code>, <code class="docutils literal notranslate"><span class="pre">fugitive</span></code>, <code class="docutils literal notranslate"><span class="pre">factor</span></code>, <code class="docutils literal notranslate"><span class="pre">search</span></code>, <code class="docutils literal notranslate"><span class="pre">transportation-and-distribution</span></code>, <code class="docutils literal notranslate"><span class="pre">economic-activity</span></code>, <code class="docutils literal notranslate"><span class="pre">real-estate</span></code></p>
|
|
841
|
-
<section id="
|
|
842
|
-
<h3>getTypes<a class="headerlink" href="#
|
|
847
|
+
<section id="gettypes">
|
|
848
|
+
<h3>getTypes<a class="headerlink" href="#gettypes" title="Link to this heading">¶</a></h3>
|
|
843
849
|
<dl class="js function">
|
|
844
850
|
<dt class="sig sig-object js" id="Metadata.getTypes">
|
|
845
851
|
<em class="property"><span class="k"><span class="pre">async</span></span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="n"><span class="pre">Metadata</span></span><span class="p"><span class="pre">.</span></span></span><span class="sig-name descname"><span class="n"><span class="pre">getTypes</span></span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">endpoint</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#Metadata.getTypes" title="Link to this definition">¶</a></dt>
|