emissions-api-sdk 1.0.12 → 1.0.14

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 (120) hide show
  1. package/README.md +65 -2
  2. package/dist/Constants.js +7 -1
  3. package/dist/api/AuditExport.js +73 -0
  4. package/dist/api/AuditLog.js +99 -0
  5. package/dist/api/EconomicActivity.js +69 -0
  6. package/dist/api/Factor.js +16 -0
  7. package/dist/api/PhysicalActivity.js +87 -0
  8. package/dist/api/RealEstate.js +25 -1
  9. package/dist/api/TypeRecommender.js +19 -2
  10. package/dist/coverage/clover.xml +172 -89
  11. package/dist/coverage/coverage-final.json +15 -8
  12. package/dist/coverage/lcov-report/index.html +21 -21
  13. package/dist/coverage/lcov-report/src/Client.ts.html +32 -32
  14. package/dist/coverage/lcov-report/src/Constants.ts.html +45 -27
  15. package/dist/coverage/lcov-report/src/api/AuditExport.ts.html +355 -0
  16. package/dist/coverage/lcov-report/src/api/AuditLog.ts.html +388 -0
  17. package/dist/coverage/lcov-report/src/api/Calculation.ts.html +1 -1
  18. package/dist/coverage/lcov-report/src/api/EconomicActivity.ts.html +212 -5
  19. package/dist/coverage/lcov-report/src/api/Factor.ts.html +54 -3
  20. package/dist/coverage/lcov-report/src/api/FactorSets.ts.html +1 -1
  21. package/dist/coverage/lcov-report/src/api/Fugitive.ts.html +1 -1
  22. package/dist/coverage/lcov-report/src/api/Location.ts.html +1 -1
  23. package/dist/coverage/lcov-report/src/api/Metadata.ts.html +1 -1
  24. package/dist/coverage/lcov-report/src/api/Mobile.ts.html +1 -1
  25. package/dist/coverage/lcov-report/src/api/PhysicalActivity.ts.html +361 -0
  26. package/dist/coverage/lcov-report/src/api/RealEstate.ts.html +78 -6
  27. package/dist/coverage/lcov-report/src/api/Stationary.ts.html +1 -1
  28. package/dist/coverage/lcov-report/src/api/TransportationAndDistribution.ts.html +1 -1
  29. package/dist/coverage/lcov-report/src/api/TypeRecommender.ts.html +55 -4
  30. package/dist/coverage/lcov-report/src/api/Usage.ts.html +1 -1
  31. package/dist/coverage/lcov-report/src/api/index.html +51 -6
  32. package/dist/coverage/lcov-report/src/index.html +7 -7
  33. package/dist/coverage/lcov-report/src/request.ts.html +8 -5
  34. package/dist/coverage/lcov-report/src/utils.ts.html +6 -6
  35. package/dist/coverage/lcov-report/test/index.html +1 -1
  36. package/dist/coverage/lcov-report/test/mocks/AttributionRequest.ts.html +151 -0
  37. package/dist/coverage/lcov-report/test/mocks/CommonRequest.ts.html +1 -1
  38. package/dist/coverage/lcov-report/test/mocks/EconomicActivityAttributionRequest.ts.html +148 -0
  39. package/dist/coverage/lcov-report/test/mocks/FactorRequest.ts.html +1 -1
  40. package/dist/coverage/lcov-report/test/mocks/GenericCalculationRequest.ts.html +1 -1
  41. package/dist/coverage/lcov-report/test/mocks/LocationRequest.ts.html +1 -1
  42. package/dist/coverage/lcov-report/test/mocks/PhysicalActivityEVICRequest.ts.html +148 -0
  43. package/dist/coverage/lcov-report/test/mocks/PhysicalActivityRequest.ts.html +151 -0
  44. package/dist/coverage/lcov-report/test/mocks/SearchRequest.ts.html +1 -1
  45. package/dist/coverage/lcov-report/test/mocks/index.html +63 -3
  46. package/dist/coverage/lcov-report/test/testUtils.ts.html +1 -1
  47. package/dist/coverage/lcov.info +284 -124
  48. package/dist/index.js +4 -1
  49. package/dist/interfaces/response/AuditExportResponse.js +2 -0
  50. package/dist/interfaces/response/AuditLogResponse.js +2 -0
  51. package/dist/request.js +1 -0
  52. package/dist/types/Constants.d.ts +6 -0
  53. package/dist/types/api/AuditExport.d.ts +42 -0
  54. package/dist/types/api/AuditLog.d.ts +37 -0
  55. package/dist/types/api/EconomicActivity.d.ts +69 -0
  56. package/dist/types/api/Factor.d.ts +16 -0
  57. package/dist/types/api/PhysicalActivity.d.ts +76 -0
  58. package/dist/types/api/RealEstate.d.ts +25 -1
  59. package/dist/types/api/TypeRecommender.d.ts +19 -2
  60. package/dist/types/index.d.ts +6 -0
  61. package/dist/types/interfaces/Api.d.ts +17 -1
  62. package/dist/types/interfaces/Config.d.ts +5 -1
  63. package/dist/types/interfaces/common.d.ts +40 -0
  64. package/dist/types/interfaces/response/AuditExportResponse.d.ts +66 -0
  65. package/dist/types/interfaces/response/AuditLogResponse.d.ts +40 -0
  66. package/dist/types/interfaces/response/TypeRecommenderResponse.d.ts +2 -0
  67. package/docs/_sources/authentication.rst.txt +26 -4
  68. package/docs/_sources/getting_started.rst.txt +762 -74
  69. package/docs/_sources/index.rst.txt +13 -0
  70. package/docs/_sources/reference.rst.txt +48 -0
  71. package/docs/_sources/troubleshooting.rst.txt +77 -12
  72. package/docs/_static/basic.css +8 -0
  73. package/docs/_static/doctools.js +5 -6
  74. package/docs/_static/language_data.js +186 -7
  75. package/docs/_static/pygments.css +146 -164
  76. package/docs/_static/searchtools.js +60 -121
  77. package/docs/_static/sphinx_highlight.js +31 -36
  78. package/docs/_static/styles/furo.css +1 -1
  79. package/docs/_static/styles/furo.css.map +1 -1
  80. package/docs/authentication.html +61 -26
  81. package/docs/client.html +33 -22
  82. package/docs/genindex.html +77 -24
  83. package/docs/getting_started.html +969 -103
  84. package/docs/index.html +69 -21
  85. package/docs/reference.html +747 -66
  86. package/docs/sdk.html +32 -21
  87. package/docs/search.html +32 -21
  88. package/docs/searchindex.js +1 -1
  89. package/docs/troubleshooting.html +105 -38
  90. package/package.json +8 -3
  91. package/sphinx-build/source/authentication.rst +26 -4
  92. package/sphinx-build/source/getting_started.rst +762 -74
  93. package/sphinx-build/source/index.rst +13 -0
  94. package/sphinx-build/source/reference.rst +48 -0
  95. package/sphinx-build/source/troubleshooting.rst +77 -12
  96. package/src/Constants.ts +6 -0
  97. package/src/api/AuditExport.ts +90 -0
  98. package/src/api/AuditLog.ts +102 -0
  99. package/src/api/EconomicActivity.ts +69 -0
  100. package/src/api/Factor.ts +17 -1
  101. package/src/api/PhysicalActivity.ts +92 -0
  102. package/src/api/RealEstate.ts +25 -1
  103. package/src/api/TypeRecommender.ts +19 -2
  104. package/src/index.ts +15 -1
  105. package/src/interfaces/Api.ts +22 -6
  106. package/src/interfaces/Config.ts +6 -1
  107. package/src/interfaces/common.ts +46 -0
  108. package/src/interfaces/response/AuditExportResponse.ts +88 -0
  109. package/src/interfaces/response/AuditLogResponse.ts +47 -0
  110. package/src/interfaces/response/TypeRecommenderResponse.ts +3 -0
  111. package/src/request.ts +1 -0
  112. package/test/apiTest.test.ts +59 -3
  113. package/test/auditExport.test.ts +68 -0
  114. package/test/auditLog.test.ts +216 -0
  115. package/test/mocks/AttributionRequest.ts +23 -0
  116. package/test/mocks/EconomicActivityAttributionRequest.ts +22 -0
  117. package/test/mocks/PhysicalActivityEVICRequest.ts +22 -0
  118. package/test/mocks/PhysicalActivityRequest.ts +23 -0
  119. package/docs/_static/base-stemmer.js +0 -476
  120. package/docs/_static/english-stemmer.js +0 -1066
@@ -3,6 +3,7 @@ import { EmissionResponse } from "../interfaces/response/EmissionResponse";
3
3
  import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
4
4
  /**
5
5
  * Performs scope 3 Spend based emission calculations by making a POST request to the economic activity API endpoint.
6
+ * Supports optional attribution with revenue for proportional allocation.
6
7
  *
7
8
  * @export
8
9
  * @param {CommonRequest} payload - The request data to be sent to the API
@@ -10,6 +11,7 @@ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResp
10
11
  * @throws {Error} May throw an error if the API request fails
11
12
  *
12
13
  * @example
14
+ * // Basic economic activity request
13
15
  * const request = {
14
16
  "time": {
15
17
  "date": "2025-01-04"
@@ -25,5 +27,72 @@ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResp
25
27
  "includeDetails": false
26
28
  };
27
29
  * const result = await calculate(request);
30
+ *
31
+ * @example
32
+ * // Economic activity request with revenue attribution
33
+ * const requestWithAttribution = {
34
+ "time": {
35
+ "date": "2025-01-04"
36
+ },
37
+ "location": {
38
+ "country": "usa"
39
+ },
40
+ "activity": {
41
+ "type": "accomodation",
42
+ "value": 1500.12,
43
+ "unit": "usd"
44
+ },
45
+ "attribution": {
46
+ "outstandingAmount": 500000.0,
47
+ "revenue": 2000000.0
48
+ },
49
+ "includeDetails": true
50
+ };
51
+ * const resultWithAttribution = await calculate(requestWithAttribution);
52
+ *
53
+ * @example
54
+ * // Economic activity request with attribution (equity/debt based for private companies)
55
+ * const requestWithEquityDebt = {
56
+ "time": {
57
+ "date": "2025-01-04"
58
+ },
59
+ "location": {
60
+ "country": "usa"
61
+ },
62
+ "activity": {
63
+ "type": "accomodation",
64
+ "value": 1500.12,
65
+ "unit": "usd"
66
+ },
67
+ "attribution": {
68
+ "outstandingAmount": 500000.0,
69
+ "totalEquity": 3000000.0,
70
+ "totalDebt": 2000000.0
71
+ },
72
+ "includeDetails": true
73
+ };
74
+ * const resultWithEquityDebt = await calculate(requestWithEquityDebt);
75
+ *
76
+ * @example
77
+ * // Economic activity request with attribution (EVIC based for listed companies)
78
+ * const requestWithEvic = {
79
+ "time": {
80
+ "date": "2025-01-04"
81
+ },
82
+ "location": {
83
+ "country": "usa"
84
+ },
85
+ "activity": {
86
+ "type": "accomodation",
87
+ "value": 1500.12,
88
+ "unit": "usd"
89
+ },
90
+ "attribution": {
91
+ "outstandingAmount": 500000.0,
92
+ "evic": 10000000.0
93
+ },
94
+ "includeDetails": true
95
+ };
96
+ * const resultWithEvic = await calculate(requestWithEvic);
28
97
  */
29
98
  export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
@@ -42,6 +42,9 @@ export declare function retrieveFactor(payload: FactorRequest): Promise<FactorRe
42
42
  * @return {Promise<SearchResponse>} A promise that resolves to the search results returned by the API
43
43
  * @throws {Error} May throw an error if the API request fails
44
44
  *
45
+ * The API applies cross-encoder reranking by default. Set `enableReranker` to
46
+ * `false` to keep semantic similarity ordering without reranking.
47
+ *
45
48
  * @example
46
49
  * // Basic search
47
50
  * const searchRequest = {
@@ -58,6 +61,19 @@ export declare function retrieveFactor(payload: FactorRequest): Promise<FactorRe
58
61
  * const results = await search(searchRequest);
59
62
  *
60
63
  * @example
64
+ * // Search without cross-encoder reranking
65
+ * const searchWithoutReranker = {
66
+ "activity": {
67
+ "search": "travel"
68
+ },
69
+ "location": {
70
+ "country": "USA"
71
+ },
72
+ "enableReranker": false
73
+ };
74
+ * const results = await search(searchWithoutReranker);
75
+ *
76
+ * @example
61
77
  * // Search with optional unit parameter
62
78
  * const searchWithUnit = {
63
79
  "time":{
@@ -0,0 +1,76 @@
1
+ import { CommonRequest } from "../interfaces/Api";
2
+ import { EmissionResponse } from "../interfaces/response/EmissionResponse";
3
+ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResponseWithDetails";
4
+ /**
5
+ * Performs scope 3 Physical activity emission calculations by making a POST request to the physical activity API endpoint.
6
+ * Supports attribution for private companies using equity/debt based calculations or EVIC (Enterprise Value Including Cash).
7
+ *
8
+ * @export
9
+ * @param {CommonRequest} payload - The request data to be sent to the API
10
+ * @return {Promise<EmissionResponse | EmissionResponseWithDetails>} A promise that resolves to the emission calculation result. Returns EmissionResponseWithDetails if includeDetails is true, otherwise EmissionResponse
11
+ * @throws {Error} May throw an error if the API request fails
12
+ *
13
+ * @example
14
+ * // Basic physical activity request
15
+ * const request = {
16
+ "time": {
17
+ "date": "2025-01-23"
18
+ },
19
+ "location": {
20
+ "country": "usa"
21
+ },
22
+ "activity": {
23
+ "type": "commercial real estate",
24
+ "value": 0.1,
25
+ "unit": "km2"
26
+ },
27
+ "includeDetails": true
28
+ };
29
+ * const result = await calculate(request);
30
+ *
31
+ * @example
32
+ * // Physical activity request with attribution (equity/debt based for private companies)
33
+ * const requestWithEquityDebt = {
34
+ "time": {
35
+ "date": "2025-01-23"
36
+ },
37
+ "location": {
38
+ "country": "usa"
39
+ },
40
+ "activity": {
41
+ "type": "commercial real estate",
42
+ "value": 0.1,
43
+ "unit": "km2"
44
+ },
45
+ "attribution": {
46
+ "outstandingAmount": 1000000,
47
+ "totalEquity": 3000000,
48
+ "totalDebt": 2000000
49
+ },
50
+ "includeDetails": true
51
+ };
52
+ * const resultWithEquityDebt = await calculate(requestWithEquityDebt);
53
+ *
54
+ * @example
55
+ * // Physical activity request with attribution (EVIC based)
56
+ * const requestWithEVIC = {
57
+ "time": {
58
+ "date": "2025-01-23"
59
+ },
60
+ "location": {
61
+ "country": "usa"
62
+ },
63
+ "activity": {
64
+ "type": "commercial real estate",
65
+ "value": 0.1,
66
+ "unit": "km2"
67
+ },
68
+ "attribution": {
69
+ "outstandingAmount": 1000000.0,
70
+ "evic": 10000000.0
71
+ },
72
+ "includeDetails": true
73
+ };
74
+ * const resultWithEVIC = await calculate(requestWithEVIC);
75
+ */
76
+ export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
@@ -10,6 +10,7 @@ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResp
10
10
  * @throws {Error} May throw an error if the API request fails
11
11
  *
12
12
  * @example
13
+ * // Basic request without attribution
13
14
  * const request = {
14
15
  "time": {
15
16
  "date": "2025-01-04"
@@ -25,5 +26,28 @@ import { EmissionResponseWithDetails } from "../interfaces/response/EmissionResp
25
26
  "includeDetails": false
26
27
  };
27
28
  * const result = await calculate(request);
28
- */
29
+ *
30
+ * @example
31
+ * // Request with attribution (property value based)
32
+ * const requestWithAttribution = {
33
+ "time": {
34
+ "date": "2022-01-01"
35
+ },
36
+ "location": {
37
+ "country": "usa",
38
+ "stateProvince": "new york"
39
+ },
40
+ "activity": {
41
+ "type": "Commercial Real Estate:Office",
42
+ "value": 123456.0,
43
+ "unit": "m2"
44
+ },
45
+ "attribution": {
46
+ "outstandingAmount": 1000000.0,
47
+ "propertyValue": 5000000.0
48
+ },
49
+ "includeDetails": true
50
+ };
51
+ * const resultWithAttribution = await calculate(requestWithAttribution);
52
+ */
29
53
  export declare function calculate(payload: CommonRequest): Promise<EmissionResponse | EmissionResponseWithDetails>;
@@ -1,13 +1,18 @@
1
1
  import { SearchRequest } from "../interfaces/Api";
2
2
  import { TypeRecommenderResponse } from "../interfaces/response/TypeRecommenderResponse";
3
3
  /**
4
- * Search for activity types using semantic search with location, time, and license context. Supports pagination.
4
+ * Search for activity types using semantic search with location, time, and license context. Supports pagination and optional reranker control.
5
5
  *
6
6
  * @export
7
7
  * @param {SearchRequest} payload - The search request data to be sent to the API
8
- * @return {Promise<TypeResponse>} A promise that resolves to the activity types returned by the API
8
+ * @return {Promise<TypeRecommenderResponse>} A promise that resolves to the activity types returned by the API
9
9
  * @throws {Error} May throw an error if the API request fails
10
10
  *
11
+ * The API applies cross-encoder reranking by default. Set `enableReranker` to
12
+ * `false` to keep semantic similarity ordering without reranking. Returned
13
+ * activity type items can include `scope`, a list of distinct GHG Protocol
14
+ * scopes associated with the activity type.
15
+ *
11
16
  * @example
12
17
  * // Basic search
13
18
  * const result = await search({
@@ -51,6 +56,18 @@ import { TypeRecommenderResponse } from "../interfaces/response/TypeRecommenderR
51
56
  });
52
57
  *
53
58
  * @example
59
+ * // Search without cross-encoder reranking
60
+ * const result = await search({
61
+ "location": {
62
+ "country": "usa"
63
+ },
64
+ "activity": {
65
+ "search": "electricity"
66
+ },
67
+ "enableReranker": false
68
+ });
69
+ *
70
+ * @example
54
71
  * // Search with optional unit parameter
55
72
  * const result = await search({
56
73
  "location": {
@@ -10,9 +10,13 @@ export * as Factor from './api/Factor';
10
10
  export * as FactorSets from './api/FactorSets';
11
11
  export * as EconomicActivity from './api/EconomicActivity';
12
12
  export * as RealEstate from './api/RealEstate';
13
+ export * as PhysicalActivity from './api/PhysicalActivity';
13
14
  export * as Metadata from './api/Metadata';
14
15
  export * as TypeRecommender from './api/TypeRecommender';
16
+ export * as AuditLog from './api/AuditLog';
17
+ export * as AuditExport from './api/AuditExport';
15
18
  export { ClientConfig } from './interfaces/Config';
19
+ export { Attribution } from './interfaces/common';
16
20
  export { AreaResponse, Location as LocationInfo } from './interfaces/response/AreaResponse';
17
21
  export { EmissionResponse } from './interfaces/response/EmissionResponse';
18
22
  export { EmissionResponseWithDetails, FactorDetails, FactorSetDetails, IncludeDetails } from './interfaces/response/EmissionResponseWithDetails';
@@ -23,3 +27,5 @@ export { TypeResponse } from './interfaces/response/TypeResponse';
23
27
  export { UnitResponse } from './interfaces/response/UnitResponse';
24
28
  export { UsageResponse } from './interfaces/response/UsageResponse';
25
29
  export { TypeRecommenderResponse, ActivityRequest } from './interfaces/response/TypeRecommenderResponse';
30
+ export { AuditLogResponse, AuditLogRequest } from './interfaces/response/AuditLogResponse';
31
+ export { AuditExportRequest, AuditExportResponse, AuditExportStatus, AuditExportStatusResponse, AuditExportLinks } from './interfaces/response/AuditExportResponse';
@@ -1,4 +1,4 @@
1
- import { Activity, Location, Time, CombinedUnitsActivity, FactorActivity, SearchActivity, Pagination, FactorActivityWithFactorId, CombinedUnitsActivityWithFactorId, ActivityWithFactorId } from "./common";
1
+ import { Activity, Location, Time, CombinedUnitsActivity, FactorActivity, SearchActivity, Pagination, FactorActivityWithFactorId, CombinedUnitsActivityWithFactorId, ActivityWithFactorId, Attribution } from "./common";
2
2
  /**
3
3
  * Represents activity data associated with a location, with simplified requirements.
4
4
  * Derived from the Activity type but makes the 'type' and 'unit' properties optional
@@ -119,6 +119,11 @@ export interface CommonRequestWithoutFactorId {
119
119
  * Contains complete activity information including type, value, and unit.
120
120
  */
121
121
  activity: Activity;
122
+ /**
123
+ * Optional attribution information for FE calculations.
124
+ * Contains outstanding amount, property value, and currency.
125
+ */
126
+ attribution?: Attribution;
122
127
  /**
123
128
  * Whether to include additional details in the response.
124
129
  * When true, the API will return more comprehensive information.
@@ -137,6 +142,11 @@ export interface CommonRequestWithFactorId {
137
142
  * The activity data for the calculation, including the specific factor ID to use.
138
143
  */
139
144
  activity: ActivityWithFactorId;
145
+ /**
146
+ * Optional attribution information for FE calculations.
147
+ * Contains outstanding amount, property value, and currency.
148
+ */
149
+ attribution?: Attribution;
140
150
  /**
141
151
  * Whether to include additional details in the response.
142
152
  * When true, the API will return more comprehensive information.
@@ -254,6 +264,12 @@ export interface SearchRequest {
254
264
  * Used to limit the number of results and implement paging.
255
265
  */
256
266
  pagination?: Pagination;
267
+ /**
268
+ * Optional reranker toggle for factor and type searches.
269
+ * Defaults to true when omitted. Set to false to use semantic similarity
270
+ * results directly without cross-encoder reranking.
271
+ */
272
+ enableReranker?: boolean;
257
273
  }
258
274
  /**
259
275
  * Union type representing either a factor request with or without a specific factor ID.
@@ -1,4 +1,4 @@
1
- import { Method } from "axios";
1
+ import { Method, ResponseType } from "axios";
2
2
  /**
3
3
  * Configuration for making HTTP requests.
4
4
  * @interface RequestConfig
@@ -24,6 +24,10 @@ export interface RequestConfig {
24
24
  * Optional HTTP headers to be included with the request.
25
25
  */
26
26
  headers?: Record<string, string>;
27
+ /**
28
+ * Optional response type expected from the API.
29
+ */
30
+ responseType?: ResponseType;
27
31
  }
28
32
  /**
29
33
  * Configuration for initializing a client instance.
@@ -158,3 +158,43 @@ export interface Pagination {
158
158
  */
159
159
  size: number;
160
160
  }
161
+ /**
162
+ * Represents attribution information for real estate, physical activity, and economic activity calculations.
163
+ * Supports four scenarios:
164
+ * 1. Property value based (for general real estate)
165
+ * 2. Equity/Debt based (for private companies)
166
+ * 3. EVIC based (Enterprise Value Including Cash for physical activity)
167
+ * 4. Revenue based (for economic activity)
168
+ * @interface Attribution
169
+ */
170
+ export interface Attribution {
171
+ /**
172
+ * The outstanding amount for the property or activity.
173
+ */
174
+ outstandingAmount?: number;
175
+ /**
176
+ * The total property value (used in property value based scenario).
177
+ * Optional - use either propertyValue OR (totalEquity + totalDebt) OR evic OR revenue.
178
+ */
179
+ propertyValue?: number;
180
+ /**
181
+ * The total equity amount (used in equity/debt based scenario for private companies).
182
+ * Optional - use either propertyValue OR (totalEquity + totalDebt) OR evic OR revenue.
183
+ */
184
+ totalEquity?: number;
185
+ /**
186
+ * The total debt amount (used in equity/debt based scenario for private companies).
187
+ * Optional - use either propertyValue OR (totalEquity + totalDebt) OR evic OR revenue.
188
+ */
189
+ totalDebt?: number;
190
+ /**
191
+ * Enterprise Value Including Cash (EVIC) - used in EVIC based scenario for physical activity calculations.
192
+ * Optional - use either propertyValue OR (totalEquity + totalDebt) OR evic OR revenue.
193
+ */
194
+ evic?: number;
195
+ /**
196
+ * Total revenue - used in revenue based scenario for economic activity calculations.
197
+ * Optional - use either propertyValue OR (totalEquity + totalDebt) OR evic OR revenue.
198
+ */
199
+ revenue?: number;
200
+ }
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Request body used to trigger an audit data export.
3
+ *
4
+ * @interface AuditExportRequest
5
+ */
6
+ export interface AuditExportRequest {
7
+ /** Inclusive start date in yyyy-MM-dd format. */
8
+ fromDate: string;
9
+ /** Inclusive end date in yyyy-MM-dd format. */
10
+ toDate: string;
11
+ /** Optional case-insensitive endpoint filter. */
12
+ apiName?: string;
13
+ }
14
+ /**
15
+ * Processing states for an audit export.
16
+ */
17
+ export type AuditExportStatus = "QUEUED" | "IN_PROGRESS" | "COMPLETED" | "FAILED" | "EXPIRED";
18
+ /**
19
+ * Follow-up links returned by the audit export API.
20
+ *
21
+ * @interface AuditExportLinks
22
+ */
23
+ export interface AuditExportLinks {
24
+ /** URL for retrieving the export status. */
25
+ status?: string;
26
+ /** URL for downloading a completed export. */
27
+ download?: string;
28
+ }
29
+ /**
30
+ * Response returned when an audit export is accepted.
31
+ *
32
+ * @interface AuditExportResponse
33
+ */
34
+ export interface AuditExportResponse {
35
+ /** Unique identifier used to retrieve the export status and download. */
36
+ requestId: string;
37
+ /** Current processing state. A newly accepted export is QUEUED. */
38
+ status: AuditExportStatus;
39
+ /** Human-readable result message. */
40
+ message?: string;
41
+ /** ISO-8601 timestamp for when the export was submitted. */
42
+ submittedAt?: string;
43
+ /** Links for retrieving the export status and download. */
44
+ links?: AuditExportLinks;
45
+ }
46
+ /**
47
+ * Response returned when checking an audit export's status.
48
+ *
49
+ * @interface AuditExportStatusResponse
50
+ */
51
+ export interface AuditExportStatusResponse {
52
+ /** Unique identifier returned when the export was triggered. */
53
+ requestId: string;
54
+ /** Current processing state. */
55
+ status: AuditExportStatus;
56
+ /** ISO-8601 timestamp for when the export was submitted. */
57
+ submittedAt?: string;
58
+ /** ISO-8601 timestamp for when processing completed. */
59
+ completedAt?: string;
60
+ /** ISO-8601 timestamp after which the completed export is unavailable. */
61
+ expiresAt?: string;
62
+ /** Download link when the export is completed. */
63
+ links?: Pick<AuditExportLinks, "download">;
64
+ /** Human-readable failure or expiry message. */
65
+ message?: string;
66
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Response interface for audit log configuration.
3
+ * Contains settings for logging requests and responses.
4
+ *
5
+ * @interface AuditLogResponse
6
+ */
7
+ export interface AuditLogResponse {
8
+ /**
9
+ * Whether to log API requests.
10
+ * When true, all incoming requests will be logged.
11
+ */
12
+ logRequest: boolean;
13
+ /**
14
+ * Whether to log API responses.
15
+ * When true, all outgoing responses will be logged.
16
+ */
17
+ logResponse: boolean;
18
+ /**
19
+ * Message providing additional context about the response.
20
+ */
21
+ message: string;
22
+ }
23
+ /**
24
+ * Request interface for updating audit log configuration.
25
+ * Used to configure which parts of API interactions should be logged.
26
+ *
27
+ * @interface AuditLogRequest
28
+ */
29
+ export interface AuditLogRequest {
30
+ /**
31
+ * Whether to log API requests.
32
+ * When true, all incoming requests will be logged.
33
+ */
34
+ logRequest: boolean;
35
+ /**
36
+ * Whether to log API responses.
37
+ * When true, all outgoing responses will be logged.
38
+ */
39
+ logResponse: boolean;
40
+ }
@@ -11,4 +11,6 @@ export interface ActivityRequest {
11
11
  activityUnit: string[];
12
12
  activityDescription: string;
13
13
  confidence: number;
14
+ /** Distinct GHG Protocol scopes associated with the activity type. */
15
+ scope?: string[];
14
16
  }
@@ -10,17 +10,39 @@ The IBM Envizi - Emissions API Node.js SDK uses OAuth 2.0 Bearer Tokens for auth
10
10
  Authentication Methods
11
11
  ----------------------
12
12
 
13
- The SDK provides two authentication methods:
13
+ The SDK provides three authentication methods:
14
14
 
15
- API Key Authentication (Recommended)
16
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
+ Personal Access Token (PAT) Authentication (Recommended)
16
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17
+
18
+ This method uses a personal access token directly:
19
+
20
+ .. code-block:: javascript
21
+
22
+ import { Client } from 'emissions-api-sdk';
23
+
24
+ await Client.getClient({
25
+ patToken: process.env.ENVIZI_PAT_TOKEN,
26
+ clientId: process.env.ENVIZI_CLIENT_ID
27
+ });
28
+
29
+ **Required parameters:**
30
+ - ``patToken``: Your personal access token
31
+ - ``clientId``: Your client identifier
32
+
33
+ .. note::
34
+
35
+ When using a PAT token, do not provide ``orgId``.
36
+
37
+ API Key Authentication
38
+ ~~~~~~~~~~~~~~~~~~~~~~
17
39
 
18
40
  This method automatically handles token generation and refreshing:
19
41
 
20
42
  .. code-block:: javascript
21
43
 
22
44
  import { Client } from 'emissions-api-sdk';
23
-
45
+
24
46
  await Client.getClient({
25
47
  apiKey: process.env.ENVIZI_API_KEY,
26
48
  clientId: process.env.ENVIZI_CLIENT_ID,