@cosmotech/aip-client 0.0.1-rc1
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 +45 -0
- package/package.json +29 -0
- package/src/apis/DefaultApi.ts +53 -0
- package/src/apis/MetricApi.ts +256 -0
- package/src/apis/MetricCostsPerYearApi.ts +286 -0
- package/src/apis/ObjectiveApi.ts +256 -0
- package/src/apis/ObjectiveWeightApi.ts +271 -0
- package/src/apis/ValueFrameworkApi.ts +256 -0
- package/src/apis/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/models/HTTPValidationError.ts +72 -0
- package/src/models/MeasurementType.ts +38 -0
- package/src/models/MetricCostsPerYearCreate.ts +102 -0
- package/src/models/MetricCostsPerYearResponse.ts +110 -0
- package/src/models/MetricCostsPerYearUpdate.ts +73 -0
- package/src/models/MetricCreate.ts +139 -0
- package/src/models/MetricResponse.ts +174 -0
- package/src/models/MetricType.ts +39 -0
- package/src/models/MetricUpdate.ts +134 -0
- package/src/models/ObjectiveCreate.ts +74 -0
- package/src/models/ObjectiveResponse.ts +109 -0
- package/src/models/ObjectiveUpdate.ts +73 -0
- package/src/models/ObjectiveWeightCreate.ts +83 -0
- package/src/models/ObjectiveWeightResponse.ts +91 -0
- package/src/models/ObjectiveWeightUpdate.ts +65 -0
- package/src/models/ValidationError.ts +91 -0
- package/src/models/ValidationErrorLocInner.ts +44 -0
- package/src/models/ValueFrameworkCreate.ts +74 -0
- package/src/models/ValueFrameworkResponse.ts +109 -0
- package/src/models/ValueFrameworkUpdate.ts +73 -0
- package/src/models/index.ts +22 -0
- package/src/runtime.ts +431 -0
- package/tsconfig.esm.json +7 -0
- package/tsconfig.json +16 -0
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
## @cosmotech/aip-client@0.0.1-rc1
|
|
2
|
+
|
|
3
|
+
This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments:
|
|
4
|
+
|
|
5
|
+
Environment
|
|
6
|
+
* Node.js
|
|
7
|
+
* Webpack
|
|
8
|
+
* Browserify
|
|
9
|
+
|
|
10
|
+
Language level
|
|
11
|
+
* ES5 - you must have a Promises/A+ library installed
|
|
12
|
+
* ES6
|
|
13
|
+
|
|
14
|
+
Module system
|
|
15
|
+
* CommonJS
|
|
16
|
+
* ES6 module system
|
|
17
|
+
|
|
18
|
+
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html))
|
|
19
|
+
|
|
20
|
+
### Building
|
|
21
|
+
|
|
22
|
+
To build and compile the typescript sources to javascript use:
|
|
23
|
+
```
|
|
24
|
+
npm install
|
|
25
|
+
npm run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Publishing
|
|
29
|
+
|
|
30
|
+
First build the package then run ```npm publish```
|
|
31
|
+
|
|
32
|
+
### Consuming
|
|
33
|
+
|
|
34
|
+
navigate to the folder of your consuming project and run one of the following commands.
|
|
35
|
+
|
|
36
|
+
_published:_
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
npm install @cosmotech/aip-client@0.0.1-rc1 --save
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
_unPublished (not recommended):_
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npm install PATH_TO_GENERATED_PACKAGE --save
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cosmotech/aip-client",
|
|
3
|
+
"version": "0.0.1-rc1",
|
|
4
|
+
"description": "OpenAPI client for @cosmotech/aip-client",
|
|
5
|
+
"author": "OpenAPI-Generator",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"typings": "./dist/index.d.ts",
|
|
12
|
+
"module": "./dist/esm/index.js",
|
|
13
|
+
"sideEffects": false,
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc && tsc -p tsconfig.esm.json",
|
|
16
|
+
"prepare": "npm run build"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^4.0"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"registry": "https://registry.npmjs.org"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/GIT_USER_ID/GIT_REPO_ID/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/GIT_USER_ID/GIT_REPO_ID#readme",
|
|
28
|
+
"license": "ISC"
|
|
29
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Asset Investment Planning
|
|
5
|
+
* API for Asset Investment Planning
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0-rc1
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export class DefaultApi extends runtime.BaseAPI {
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Root
|
|
25
|
+
*/
|
|
26
|
+
async rootAboutGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
|
|
27
|
+
const queryParameters: any = {};
|
|
28
|
+
|
|
29
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
30
|
+
|
|
31
|
+
const response = await this.request({
|
|
32
|
+
path: `/about`,
|
|
33
|
+
method: 'GET',
|
|
34
|
+
headers: headerParameters,
|
|
35
|
+
query: queryParameters,
|
|
36
|
+
}, initOverrides);
|
|
37
|
+
|
|
38
|
+
if (this.isJsonMime(response.headers.get('content-type'))) {
|
|
39
|
+
return new runtime.JSONApiResponse<any>(response);
|
|
40
|
+
} else {
|
|
41
|
+
return new runtime.TextApiResponse(response) as any;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Root
|
|
47
|
+
*/
|
|
48
|
+
async rootAboutGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
|
|
49
|
+
const response = await this.rootAboutGetRaw(initOverrides);
|
|
50
|
+
return await response.value();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Asset Investment Planning
|
|
5
|
+
* API for Asset Investment Planning
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0-rc1
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
MetricCreate,
|
|
19
|
+
MetricResponse,
|
|
20
|
+
MetricUpdate,
|
|
21
|
+
} from '../models/index';
|
|
22
|
+
import {
|
|
23
|
+
MetricCreateFromJSON,
|
|
24
|
+
MetricCreateToJSON,
|
|
25
|
+
MetricResponseFromJSON,
|
|
26
|
+
MetricResponseToJSON,
|
|
27
|
+
MetricUpdateFromJSON,
|
|
28
|
+
MetricUpdateToJSON,
|
|
29
|
+
} from '../models/index';
|
|
30
|
+
|
|
31
|
+
export interface DeleteMetricMetricMetricIdDeleteRequest {
|
|
32
|
+
metricId: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface GetMetricByIdMetricMetricIdGetRequest {
|
|
36
|
+
metricId: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface GetMetricsMetricGetRequest {
|
|
40
|
+
offset?: number;
|
|
41
|
+
limit?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface PatchMetricMetricMetricIdPatchRequest {
|
|
45
|
+
metricId: string;
|
|
46
|
+
metricUpdate: MetricUpdate;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface PostMetricMetricPostRequest {
|
|
50
|
+
metricCreate: MetricCreate;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
56
|
+
export class MetricApi extends runtime.BaseAPI {
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Delete an existing metric by its ID. Associated metric costs per year are also deleted via cascade.
|
|
60
|
+
* Delete a metric
|
|
61
|
+
*/
|
|
62
|
+
async deleteMetricMetricMetricIdDeleteRaw(requestParameters: DeleteMetricMetricMetricIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
63
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
64
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling deleteMetricMetricMetricIdDelete.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const queryParameters: any = {};
|
|
68
|
+
|
|
69
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
70
|
+
|
|
71
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
72
|
+
// oauth required
|
|
73
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const response = await this.request({
|
|
77
|
+
path: `/metric/{metric_id}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))),
|
|
78
|
+
method: 'DELETE',
|
|
79
|
+
headers: headerParameters,
|
|
80
|
+
query: queryParameters,
|
|
81
|
+
}, initOverrides);
|
|
82
|
+
|
|
83
|
+
return new runtime.VoidApiResponse(response);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Delete an existing metric by its ID. Associated metric costs per year are also deleted via cascade.
|
|
88
|
+
* Delete a metric
|
|
89
|
+
*/
|
|
90
|
+
async deleteMetricMetricMetricIdDelete(requestParameters: DeleteMetricMetricMetricIdDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
91
|
+
await this.deleteMetricMetricMetricIdDeleteRaw(requestParameters, initOverrides);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Retrieve a single metric by its ID.
|
|
96
|
+
* Get a metric by ID
|
|
97
|
+
*/
|
|
98
|
+
async getMetricByIdMetricMetricIdGetRaw(requestParameters: GetMetricByIdMetricMetricIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricResponse>> {
|
|
99
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
100
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling getMetricByIdMetricMetricIdGet.');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const queryParameters: any = {};
|
|
104
|
+
|
|
105
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
106
|
+
|
|
107
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
108
|
+
// oauth required
|
|
109
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const response = await this.request({
|
|
113
|
+
path: `/metric/{metric_id}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))),
|
|
114
|
+
method: 'GET',
|
|
115
|
+
headers: headerParameters,
|
|
116
|
+
query: queryParameters,
|
|
117
|
+
}, initOverrides);
|
|
118
|
+
|
|
119
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricResponseFromJSON(jsonValue));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Retrieve a single metric by its ID.
|
|
124
|
+
* Get a metric by ID
|
|
125
|
+
*/
|
|
126
|
+
async getMetricByIdMetricMetricIdGet(requestParameters: GetMetricByIdMetricMetricIdGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricResponse> {
|
|
127
|
+
const response = await this.getMetricByIdMetricMetricIdGetRaw(requestParameters, initOverrides);
|
|
128
|
+
return await response.value();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Retrieve a paginated list of all metrics.
|
|
133
|
+
* List metrics
|
|
134
|
+
*/
|
|
135
|
+
async getMetricsMetricGetRaw(requestParameters: GetMetricsMetricGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<MetricResponse>>> {
|
|
136
|
+
const queryParameters: any = {};
|
|
137
|
+
|
|
138
|
+
if (requestParameters.offset !== undefined) {
|
|
139
|
+
queryParameters['offset'] = requestParameters.offset;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (requestParameters.limit !== undefined) {
|
|
143
|
+
queryParameters['limit'] = requestParameters.limit;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
147
|
+
|
|
148
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
149
|
+
// oauth required
|
|
150
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const response = await this.request({
|
|
154
|
+
path: `/metric/`,
|
|
155
|
+
method: 'GET',
|
|
156
|
+
headers: headerParameters,
|
|
157
|
+
query: queryParameters,
|
|
158
|
+
}, initOverrides);
|
|
159
|
+
|
|
160
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MetricResponseFromJSON));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Retrieve a paginated list of all metrics.
|
|
165
|
+
* List metrics
|
|
166
|
+
*/
|
|
167
|
+
async getMetricsMetricGet(requestParameters: GetMetricsMetricGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<MetricResponse>> {
|
|
168
|
+
const response = await this.getMetricsMetricGetRaw(requestParameters, initOverrides);
|
|
169
|
+
return await response.value();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Update one or more fields of an existing metric. Only the fields included in the request body will be modified; omitted fields remain unchanged.
|
|
174
|
+
* Partially update a metric
|
|
175
|
+
*/
|
|
176
|
+
async patchMetricMetricMetricIdPatchRaw(requestParameters: PatchMetricMetricMetricIdPatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricResponse>> {
|
|
177
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
178
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling patchMetricMetricMetricIdPatch.');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (requestParameters.metricUpdate === null || requestParameters.metricUpdate === undefined) {
|
|
182
|
+
throw new runtime.RequiredError('metricUpdate','Required parameter requestParameters.metricUpdate was null or undefined when calling patchMetricMetricMetricIdPatch.');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const queryParameters: any = {};
|
|
186
|
+
|
|
187
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
188
|
+
|
|
189
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
190
|
+
|
|
191
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
192
|
+
// oauth required
|
|
193
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const response = await this.request({
|
|
197
|
+
path: `/metric/{metric_id}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))),
|
|
198
|
+
method: 'PATCH',
|
|
199
|
+
headers: headerParameters,
|
|
200
|
+
query: queryParameters,
|
|
201
|
+
body: MetricUpdateToJSON(requestParameters.metricUpdate),
|
|
202
|
+
}, initOverrides);
|
|
203
|
+
|
|
204
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricResponseFromJSON(jsonValue));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Update one or more fields of an existing metric. Only the fields included in the request body will be modified; omitted fields remain unchanged.
|
|
209
|
+
* Partially update a metric
|
|
210
|
+
*/
|
|
211
|
+
async patchMetricMetricMetricIdPatch(requestParameters: PatchMetricMetricMetricIdPatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricResponse> {
|
|
212
|
+
const response = await this.patchMetricMetricMetricIdPatchRaw(requestParameters, initOverrides);
|
|
213
|
+
return await response.value();
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Create a new metric linked to an objective. Requires metric_type (monetized/tracked/bounded) and measurement_type (maximization/minimization).
|
|
218
|
+
* Create a metric
|
|
219
|
+
*/
|
|
220
|
+
async postMetricMetricPostRaw(requestParameters: PostMetricMetricPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricResponse>> {
|
|
221
|
+
if (requestParameters.metricCreate === null || requestParameters.metricCreate === undefined) {
|
|
222
|
+
throw new runtime.RequiredError('metricCreate','Required parameter requestParameters.metricCreate was null or undefined when calling postMetricMetricPost.');
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const queryParameters: any = {};
|
|
226
|
+
|
|
227
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
228
|
+
|
|
229
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
230
|
+
|
|
231
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
232
|
+
// oauth required
|
|
233
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const response = await this.request({
|
|
237
|
+
path: `/metric/`,
|
|
238
|
+
method: 'POST',
|
|
239
|
+
headers: headerParameters,
|
|
240
|
+
query: queryParameters,
|
|
241
|
+
body: MetricCreateToJSON(requestParameters.metricCreate),
|
|
242
|
+
}, initOverrides);
|
|
243
|
+
|
|
244
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricResponseFromJSON(jsonValue));
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Create a new metric linked to an objective. Requires metric_type (monetized/tracked/bounded) and measurement_type (maximization/minimization).
|
|
249
|
+
* Create a metric
|
|
250
|
+
*/
|
|
251
|
+
async postMetricMetricPost(requestParameters: PostMetricMetricPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricResponse> {
|
|
252
|
+
const response = await this.postMetricMetricPostRaw(requestParameters, initOverrides);
|
|
253
|
+
return await response.value();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Asset Investment Planning
|
|
5
|
+
* API for Asset Investment Planning
|
|
6
|
+
*
|
|
7
|
+
* The version of the OpenAPI document: 0.1.0-rc1
|
|
8
|
+
*
|
|
9
|
+
*
|
|
10
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
+
* https://openapi-generator.tech
|
|
12
|
+
* Do not edit the class manually.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
import * as runtime from '../runtime';
|
|
17
|
+
import type {
|
|
18
|
+
MetricCostsPerYearCreate,
|
|
19
|
+
MetricCostsPerYearResponse,
|
|
20
|
+
MetricCostsPerYearUpdate,
|
|
21
|
+
} from '../models/index';
|
|
22
|
+
import {
|
|
23
|
+
MetricCostsPerYearCreateFromJSON,
|
|
24
|
+
MetricCostsPerYearCreateToJSON,
|
|
25
|
+
MetricCostsPerYearResponseFromJSON,
|
|
26
|
+
MetricCostsPerYearResponseToJSON,
|
|
27
|
+
MetricCostsPerYearUpdateFromJSON,
|
|
28
|
+
MetricCostsPerYearUpdateToJSON,
|
|
29
|
+
} from '../models/index';
|
|
30
|
+
|
|
31
|
+
export interface DeleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDeleteRequest {
|
|
32
|
+
metricId: string;
|
|
33
|
+
frameworkId: string;
|
|
34
|
+
year: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface GetMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGetRequest {
|
|
38
|
+
metricId: string;
|
|
39
|
+
frameworkId: string;
|
|
40
|
+
year: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GetMetricCostsMetricCostsPerYearGetRequest {
|
|
44
|
+
offset?: number;
|
|
45
|
+
limit?: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface PatchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatchRequest {
|
|
49
|
+
metricId: string;
|
|
50
|
+
frameworkId: string;
|
|
51
|
+
year: number;
|
|
52
|
+
metricCostsPerYearUpdate: MetricCostsPerYearUpdate;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface PostMetricCostMetricCostsPerYearPostRequest {
|
|
56
|
+
metricCostsPerYearCreate: MetricCostsPerYearCreate;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
*/
|
|
62
|
+
export class MetricCostsPerYearApi extends runtime.BaseAPI {
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Delete a metric cost entry by its composite key (metric_id, framework_id, year).
|
|
66
|
+
* Delete metric costs for a year
|
|
67
|
+
*/
|
|
68
|
+
async deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDeleteRaw(requestParameters: DeleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
|
|
69
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
70
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDelete.');
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (requestParameters.frameworkId === null || requestParameters.frameworkId === undefined) {
|
|
74
|
+
throw new runtime.RequiredError('frameworkId','Required parameter requestParameters.frameworkId was null or undefined when calling deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDelete.');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (requestParameters.year === null || requestParameters.year === undefined) {
|
|
78
|
+
throw new runtime.RequiredError('year','Required parameter requestParameters.year was null or undefined when calling deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDelete.');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const queryParameters: any = {};
|
|
82
|
+
|
|
83
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
84
|
+
|
|
85
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
86
|
+
// oauth required
|
|
87
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const response = await this.request({
|
|
91
|
+
path: `/metric_costs_per_year/{metric_id}/{framework_id}/{year}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))).replace(`{${"framework_id"}}`, encodeURIComponent(String(requestParameters.frameworkId))).replace(`{${"year"}}`, encodeURIComponent(String(requestParameters.year))),
|
|
92
|
+
method: 'DELETE',
|
|
93
|
+
headers: headerParameters,
|
|
94
|
+
query: queryParameters,
|
|
95
|
+
}, initOverrides);
|
|
96
|
+
|
|
97
|
+
return new runtime.VoidApiResponse(response);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Delete a metric cost entry by its composite key (metric_id, framework_id, year).
|
|
102
|
+
* Delete metric costs for a year
|
|
103
|
+
*/
|
|
104
|
+
async deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDelete(requestParameters: DeleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
|
|
105
|
+
await this.deleteMetricCostMetricCostsPerYearMetricIdFrameworkIdYearDeleteRaw(requestParameters, initOverrides);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Retrieve cost data for a specific metric within a framework for a given year.
|
|
110
|
+
* Get a yearly metric cost by metric, framework, and year
|
|
111
|
+
*/
|
|
112
|
+
async getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGetRaw(requestParameters: GetMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricCostsPerYearResponse>> {
|
|
113
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
114
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGet.');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (requestParameters.frameworkId === null || requestParameters.frameworkId === undefined) {
|
|
118
|
+
throw new runtime.RequiredError('frameworkId','Required parameter requestParameters.frameworkId was null or undefined when calling getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGet.');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (requestParameters.year === null || requestParameters.year === undefined) {
|
|
122
|
+
throw new runtime.RequiredError('year','Required parameter requestParameters.year was null or undefined when calling getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGet.');
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const queryParameters: any = {};
|
|
126
|
+
|
|
127
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
128
|
+
|
|
129
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
130
|
+
// oauth required
|
|
131
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const response = await this.request({
|
|
135
|
+
path: `/metric_costs_per_year/{metric_id}/{framework_id}/{year}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))).replace(`{${"framework_id"}}`, encodeURIComponent(String(requestParameters.frameworkId))).replace(`{${"year"}}`, encodeURIComponent(String(requestParameters.year))),
|
|
136
|
+
method: 'GET',
|
|
137
|
+
headers: headerParameters,
|
|
138
|
+
query: queryParameters,
|
|
139
|
+
}, initOverrides);
|
|
140
|
+
|
|
141
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricCostsPerYearResponseFromJSON(jsonValue));
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Retrieve cost data for a specific metric within a framework for a given year.
|
|
146
|
+
* Get a yearly metric cost by metric, framework, and year
|
|
147
|
+
*/
|
|
148
|
+
async getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGet(requestParameters: GetMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricCostsPerYearResponse> {
|
|
149
|
+
const response = await this.getMetricCostByKeysMetricCostsPerYearMetricIdFrameworkIdYearGetRaw(requestParameters, initOverrides);
|
|
150
|
+
return await response.value();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Retrieve a paginated list of all yearly metric cost overrides.
|
|
155
|
+
* List yearly metric costs
|
|
156
|
+
*/
|
|
157
|
+
async getMetricCostsMetricCostsPerYearGetRaw(requestParameters: GetMetricCostsMetricCostsPerYearGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<MetricCostsPerYearResponse>>> {
|
|
158
|
+
const queryParameters: any = {};
|
|
159
|
+
|
|
160
|
+
if (requestParameters.offset !== undefined) {
|
|
161
|
+
queryParameters['offset'] = requestParameters.offset;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (requestParameters.limit !== undefined) {
|
|
165
|
+
queryParameters['limit'] = requestParameters.limit;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
169
|
+
|
|
170
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
171
|
+
// oauth required
|
|
172
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const response = await this.request({
|
|
176
|
+
path: `/metric_costs_per_year/`,
|
|
177
|
+
method: 'GET',
|
|
178
|
+
headers: headerParameters,
|
|
179
|
+
query: queryParameters,
|
|
180
|
+
}, initOverrides);
|
|
181
|
+
|
|
182
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(MetricCostsPerYearResponseFromJSON));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Retrieve a paginated list of all yearly metric cost overrides.
|
|
187
|
+
* List yearly metric costs
|
|
188
|
+
*/
|
|
189
|
+
async getMetricCostsMetricCostsPerYearGet(requestParameters: GetMetricCostsMetricCostsPerYearGetRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<MetricCostsPerYearResponse>> {
|
|
190
|
+
const response = await this.getMetricCostsMetricCostsPerYearGetRaw(requestParameters, initOverrides);
|
|
191
|
+
return await response.value();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Update the perceived and/or direct cost of a metric for a specific year and framework. Identified by the composite key (metric_id, framework_id, year).
|
|
196
|
+
* Partially update metric costs for a year
|
|
197
|
+
*/
|
|
198
|
+
async patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatchRaw(requestParameters: PatchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricCostsPerYearResponse>> {
|
|
199
|
+
if (requestParameters.metricId === null || requestParameters.metricId === undefined) {
|
|
200
|
+
throw new runtime.RequiredError('metricId','Required parameter requestParameters.metricId was null or undefined when calling patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatch.');
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (requestParameters.frameworkId === null || requestParameters.frameworkId === undefined) {
|
|
204
|
+
throw new runtime.RequiredError('frameworkId','Required parameter requestParameters.frameworkId was null or undefined when calling patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatch.');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (requestParameters.year === null || requestParameters.year === undefined) {
|
|
208
|
+
throw new runtime.RequiredError('year','Required parameter requestParameters.year was null or undefined when calling patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatch.');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (requestParameters.metricCostsPerYearUpdate === null || requestParameters.metricCostsPerYearUpdate === undefined) {
|
|
212
|
+
throw new runtime.RequiredError('metricCostsPerYearUpdate','Required parameter requestParameters.metricCostsPerYearUpdate was null or undefined when calling patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatch.');
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const queryParameters: any = {};
|
|
216
|
+
|
|
217
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
218
|
+
|
|
219
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
220
|
+
|
|
221
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
222
|
+
// oauth required
|
|
223
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const response = await this.request({
|
|
227
|
+
path: `/metric_costs_per_year/{metric_id}/{framework_id}/{year}`.replace(`{${"metric_id"}}`, encodeURIComponent(String(requestParameters.metricId))).replace(`{${"framework_id"}}`, encodeURIComponent(String(requestParameters.frameworkId))).replace(`{${"year"}}`, encodeURIComponent(String(requestParameters.year))),
|
|
228
|
+
method: 'PATCH',
|
|
229
|
+
headers: headerParameters,
|
|
230
|
+
query: queryParameters,
|
|
231
|
+
body: MetricCostsPerYearUpdateToJSON(requestParameters.metricCostsPerYearUpdate),
|
|
232
|
+
}, initOverrides);
|
|
233
|
+
|
|
234
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricCostsPerYearResponseFromJSON(jsonValue));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Update the perceived and/or direct cost of a metric for a specific year and framework. Identified by the composite key (metric_id, framework_id, year).
|
|
239
|
+
* Partially update metric costs for a year
|
|
240
|
+
*/
|
|
241
|
+
async patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatch(requestParameters: PatchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatchRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricCostsPerYearResponse> {
|
|
242
|
+
const response = await this.patchMetricCostMetricCostsPerYearMetricIdFrameworkIdYearPatchRaw(requestParameters, initOverrides);
|
|
243
|
+
return await response.value();
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Create a yearly cost override for a metric within a framework. Year must be between 1600 and 3000, costs must be >= 0.
|
|
248
|
+
* Create a yearly metric cost
|
|
249
|
+
*/
|
|
250
|
+
async postMetricCostMetricCostsPerYearPostRaw(requestParameters: PostMetricCostMetricCostsPerYearPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MetricCostsPerYearResponse>> {
|
|
251
|
+
if (requestParameters.metricCostsPerYearCreate === null || requestParameters.metricCostsPerYearCreate === undefined) {
|
|
252
|
+
throw new runtime.RequiredError('metricCostsPerYearCreate','Required parameter requestParameters.metricCostsPerYearCreate was null or undefined when calling postMetricCostMetricCostsPerYearPost.');
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const queryParameters: any = {};
|
|
256
|
+
|
|
257
|
+
const headerParameters: runtime.HTTPHeaders = {};
|
|
258
|
+
|
|
259
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
260
|
+
|
|
261
|
+
if (this.configuration && this.configuration.accessToken) {
|
|
262
|
+
// oauth required
|
|
263
|
+
headerParameters["Authorization"] = await this.configuration.accessToken("OAuth2AuthorizationCodeBearer", []);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const response = await this.request({
|
|
267
|
+
path: `/metric_costs_per_year/`,
|
|
268
|
+
method: 'POST',
|
|
269
|
+
headers: headerParameters,
|
|
270
|
+
query: queryParameters,
|
|
271
|
+
body: MetricCostsPerYearCreateToJSON(requestParameters.metricCostsPerYearCreate),
|
|
272
|
+
}, initOverrides);
|
|
273
|
+
|
|
274
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => MetricCostsPerYearResponseFromJSON(jsonValue));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Create a yearly cost override for a metric within a framework. Year must be between 1600 and 3000, costs must be >= 0.
|
|
279
|
+
* Create a yearly metric cost
|
|
280
|
+
*/
|
|
281
|
+
async postMetricCostMetricCostsPerYearPost(requestParameters: PostMetricCostMetricCostsPerYearPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MetricCostsPerYearResponse> {
|
|
282
|
+
const response = await this.postMetricCostMetricCostsPerYearPostRaw(requestParameters, initOverrides);
|
|
283
|
+
return await response.value();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|