@cirrobio/api-client 0.0.7-alpha → 0.0.8-alpha

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.
@@ -31,6 +31,7 @@ src/models/Executor.ts
31
31
  src/models/FormSchema.ts
32
32
  src/models/GetExecutionLogsResponse.ts
33
33
  src/models/LogEntry.ts
34
+ src/models/MetricRecord.ts
34
35
  src/models/NotebookInstance.ts
35
36
  src/models/OpenNotebookInstanceResponse.ts
36
37
  src/models/Process.ts
@@ -41,6 +42,7 @@ src/models/ProjectMetrics.ts
41
42
  src/models/ProjectRequest.ts
42
43
  src/models/ProjectRole.ts
43
44
  src/models/ProjectSettings.ts
45
+ src/models/ProjectUser.ts
44
46
  src/models/Reference.ts
45
47
  src/models/ReferenceType.ts
46
48
  src/models/Region.ts
package/README.md CHANGED
@@ -36,7 +36,7 @@ navigate to the folder of your consuming project and run one of the following co
36
36
  _published:_
37
37
 
38
38
  ```
39
- npm install @cirrobio/api-client@0.0.7-alpha --save
39
+ npm install @cirrobio/api-client@0.0.8-alpha --save
40
40
  ```
41
41
 
42
42
  _unPublished (not recommended):_
@@ -18,6 +18,16 @@ export interface GetProjectMetricsRequest {
18
18
  *
19
19
  */
20
20
  export declare class MetricsApi extends runtime.BaseAPI {
21
+ /**
22
+ * Retrieves metrics for all projects.
23
+ * Get all project metrics
24
+ */
25
+ getAllMetricsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMetrics>>>;
26
+ /**
27
+ * Retrieves metrics for all projects.
28
+ * Get all project metrics
29
+ */
30
+ getAllMetrics(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMetrics>>;
21
31
  /**
22
32
  * Retrieves metrics about a project.
23
33
  * Get project metrics
@@ -75,6 +75,58 @@ var MetricsApi = /** @class */ (function (_super) {
75
75
  function MetricsApi() {
76
76
  return _super !== null && _super.apply(this, arguments) || this;
77
77
  }
78
+ /**
79
+ * Retrieves metrics for all projects.
80
+ * Get all project metrics
81
+ */
82
+ MetricsApi.prototype.getAllMetricsRaw = function (initOverrides) {
83
+ return __awaiter(this, void 0, void 0, function () {
84
+ var queryParameters, headerParameters, token, tokenString, response;
85
+ return __generator(this, function (_a) {
86
+ switch (_a.label) {
87
+ case 0:
88
+ queryParameters = {};
89
+ headerParameters = {};
90
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
91
+ token = this.configuration.accessToken;
92
+ return [4 /*yield*/, token("accessToken", [])];
93
+ case 1:
94
+ tokenString = _a.sent();
95
+ if (tokenString) {
96
+ headerParameters["Authorization"] = "Bearer ".concat(tokenString);
97
+ }
98
+ _a.label = 2;
99
+ case 2: return [4 /*yield*/, this.request({
100
+ path: "/metrics",
101
+ method: 'GET',
102
+ headers: headerParameters,
103
+ query: queryParameters,
104
+ }, initOverrides)];
105
+ case 3:
106
+ response = _a.sent();
107
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return jsonValue.map(index_1.ProjectMetricsFromJSON); })];
108
+ }
109
+ });
110
+ });
111
+ };
112
+ /**
113
+ * Retrieves metrics for all projects.
114
+ * Get all project metrics
115
+ */
116
+ MetricsApi.prototype.getAllMetrics = function (initOverrides) {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var response;
119
+ return __generator(this, function (_a) {
120
+ switch (_a.label) {
121
+ case 0: return [4 /*yield*/, this.getAllMetricsRaw(initOverrides)];
122
+ case 1:
123
+ response = _a.sent();
124
+ return [4 /*yield*/, response.value()];
125
+ case 2: return [2 /*return*/, _a.sent()];
126
+ }
127
+ });
128
+ });
129
+ };
78
130
  /**
79
131
  * Retrieves metrics about a project.
80
132
  * Get project metrics
@@ -10,13 +10,16 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import type { CreateResponse, Project, ProjectDetail, ProjectRequest, SetUserProjectRoleRequest, Tag } from '../models/index';
13
+ import type { CreateResponse, Project, ProjectDetail, ProjectRequest, ProjectUser, SetUserProjectRoleRequest, Tag } from '../models/index';
14
14
  export interface CreateProjectRequest {
15
15
  projectRequest: ProjectRequest;
16
16
  }
17
17
  export interface GetProjectRequest {
18
18
  projectId: string;
19
19
  }
20
+ export interface GetProjectUsersRequest {
21
+ projectId: string;
22
+ }
20
23
  export interface SetUserProjectRoleOperationRequest {
21
24
  projectId: string;
22
25
  username: string;
@@ -54,6 +57,16 @@ export declare class ProjectsApi extends runtime.BaseAPI {
54
57
  * Get project
55
58
  */
56
59
  getProject(requestParameters: GetProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectDetail>;
60
+ /**
61
+ * Gets users who have access to the project
62
+ * Get project permissions
63
+ */
64
+ getProjectUsersRaw(requestParameters: GetProjectUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectUser>>>;
65
+ /**
66
+ * Gets users who have access to the project
67
+ * Get project permissions
68
+ */
69
+ getProjectUsers(requestParameters: GetProjectUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectUser>>;
57
70
  /**
58
71
  * Retrieve a list of projects
59
72
  * Get projects
@@ -187,6 +187,61 @@ var ProjectsApi = /** @class */ (function (_super) {
187
187
  });
188
188
  });
189
189
  };
190
+ /**
191
+ * Gets users who have access to the project
192
+ * Get project permissions
193
+ */
194
+ ProjectsApi.prototype.getProjectUsersRaw = function (requestParameters, initOverrides) {
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ var queryParameters, headerParameters, token, tokenString, response;
197
+ return __generator(this, function (_a) {
198
+ switch (_a.label) {
199
+ case 0:
200
+ if (requestParameters.projectId === null || requestParameters.projectId === undefined) {
201
+ throw new runtime.RequiredError('projectId', 'Required parameter requestParameters.projectId was null or undefined when calling getProjectUsers.');
202
+ }
203
+ queryParameters = {};
204
+ headerParameters = {};
205
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
206
+ token = this.configuration.accessToken;
207
+ return [4 /*yield*/, token("accessToken", [])];
208
+ case 1:
209
+ tokenString = _a.sent();
210
+ if (tokenString) {
211
+ headerParameters["Authorization"] = "Bearer ".concat(tokenString);
212
+ }
213
+ _a.label = 2;
214
+ case 2: return [4 /*yield*/, this.request({
215
+ path: "/projects/{projectId}/permissions".replace("{".concat("projectId", "}"), encodeURIComponent(String(requestParameters.projectId))),
216
+ method: 'GET',
217
+ headers: headerParameters,
218
+ query: queryParameters,
219
+ }, initOverrides)];
220
+ case 3:
221
+ response = _a.sent();
222
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return jsonValue.map(index_1.ProjectUserFromJSON); })];
223
+ }
224
+ });
225
+ });
226
+ };
227
+ /**
228
+ * Gets users who have access to the project
229
+ * Get project permissions
230
+ */
231
+ ProjectsApi.prototype.getProjectUsers = function (requestParameters, initOverrides) {
232
+ return __awaiter(this, void 0, void 0, function () {
233
+ var response;
234
+ return __generator(this, function (_a) {
235
+ switch (_a.label) {
236
+ case 0: return [4 /*yield*/, this.getProjectUsersRaw(requestParameters, initOverrides)];
237
+ case 1:
238
+ response = _a.sent();
239
+ return [4 /*yield*/, response.value()];
240
+ case 2: return [2 /*return*/, _a.sent()];
241
+ }
242
+ });
243
+ });
244
+ };
190
245
  /**
191
246
  * Retrieve a list of projects
192
247
  * Get projects
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Cirro Data
3
+ * Cirro Data Platform service API
4
+ *
5
+ * The version of the OpenAPI document: latest
6
+ * Contact: support@cirro.bio
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface MetricRecord
16
+ */
17
+ export interface MetricRecord {
18
+ /**
19
+ *
20
+ * @type {Date}
21
+ * @memberof MetricRecord
22
+ */
23
+ date: Date;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof MetricRecord
28
+ */
29
+ unit: string;
30
+ /**
31
+ * Map of service names to metric value
32
+ * @type {{ [key: string]: number; }}
33
+ * @memberof MetricRecord
34
+ */
35
+ services?: {
36
+ [key: string]: number;
37
+ };
38
+ }
39
+ /**
40
+ * Check if a given object implements the MetricRecord interface.
41
+ */
42
+ export declare function instanceOfMetricRecord(value: object): boolean;
43
+ export declare function MetricRecordFromJSON(json: any): MetricRecord;
44
+ export declare function MetricRecordFromJSONTyped(json: any, ignoreDiscriminator: boolean): MetricRecord;
45
+ export declare function MetricRecordToJSON(value?: MetricRecord | null): any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Cirro Data
6
+ * Cirro Data Platform service API
7
+ *
8
+ * The version of the OpenAPI document: latest
9
+ * Contact: support@cirro.bio
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.MetricRecordToJSON = exports.MetricRecordFromJSONTyped = exports.MetricRecordFromJSON = exports.instanceOfMetricRecord = void 0;
17
+ var runtime_1 = require("../runtime");
18
+ /**
19
+ * Check if a given object implements the MetricRecord interface.
20
+ */
21
+ function instanceOfMetricRecord(value) {
22
+ var isInstance = true;
23
+ isInstance = isInstance && "date" in value;
24
+ isInstance = isInstance && "unit" in value;
25
+ return isInstance;
26
+ }
27
+ exports.instanceOfMetricRecord = instanceOfMetricRecord;
28
+ function MetricRecordFromJSON(json) {
29
+ return MetricRecordFromJSONTyped(json, false);
30
+ }
31
+ exports.MetricRecordFromJSON = MetricRecordFromJSON;
32
+ function MetricRecordFromJSONTyped(json, ignoreDiscriminator) {
33
+ if ((json === undefined) || (json === null)) {
34
+ return json;
35
+ }
36
+ return {
37
+ 'date': (new Date(json['date'])),
38
+ 'unit': json['unit'],
39
+ 'services': !(0, runtime_1.exists)(json, 'services') ? undefined : json['services'],
40
+ };
41
+ }
42
+ exports.MetricRecordFromJSONTyped = MetricRecordFromJSONTyped;
43
+ function MetricRecordToJSON(value) {
44
+ if (value === undefined) {
45
+ return undefined;
46
+ }
47
+ if (value === null) {
48
+ return null;
49
+ }
50
+ return {
51
+ 'date': (value.date.toISOString().substring(0, 10)),
52
+ 'unit': value.unit,
53
+ 'services': value.services,
54
+ };
55
+ }
56
+ exports.MetricRecordToJSON = MetricRecordToJSON;
@@ -9,6 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { MetricRecord } from './MetricRecord';
12
13
  /**
13
14
  *
14
15
  * @export
@@ -23,22 +24,16 @@ export interface ProjectMetrics {
23
24
  projectId: string;
24
25
  /**
25
26
  * Costs by service by month
26
- * @type {{ [key: string]: { [key: string]: number; }; }}
27
+ * @type {Array<MetricRecord>}
27
28
  * @memberof ProjectMetrics
28
29
  */
29
- costs?: {
30
- [key: string]: {
31
- [key: string]: number;
32
- };
33
- };
30
+ costs?: Array<MetricRecord>;
34
31
  /**
35
32
  * Storage usage by tier by day
36
- * @type {{ [key: string]: any; }}
33
+ * @type {Array<MetricRecord>}
37
34
  * @memberof ProjectMetrics
38
35
  */
39
- storageMetrics?: {
40
- [key: string]: any;
41
- };
36
+ storageMetrics?: Array<MetricRecord>;
42
37
  }
43
38
  /**
44
39
  * Check if a given object implements the ProjectMetrics interface.
@@ -15,6 +15,7 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ProjectMetricsToJSON = exports.ProjectMetricsFromJSONTyped = exports.ProjectMetricsFromJSON = exports.instanceOfProjectMetrics = void 0;
17
17
  var runtime_1 = require("../runtime");
18
+ var MetricRecord_1 = require("./MetricRecord");
18
19
  /**
19
20
  * Check if a given object implements the ProjectMetrics interface.
20
21
  */
@@ -34,8 +35,8 @@ function ProjectMetricsFromJSONTyped(json, ignoreDiscriminator) {
34
35
  }
35
36
  return {
36
37
  'projectId': json['projectId'],
37
- 'costs': !(0, runtime_1.exists)(json, 'costs') ? undefined : json['costs'],
38
- 'storageMetrics': !(0, runtime_1.exists)(json, 'storageMetrics') ? undefined : json['storageMetrics'],
38
+ 'costs': !(0, runtime_1.exists)(json, 'costs') ? undefined : (json['costs'].map(MetricRecord_1.MetricRecordFromJSON)),
39
+ 'storageMetrics': !(0, runtime_1.exists)(json, 'storageMetrics') ? undefined : (json['storageMetrics'].map(MetricRecord_1.MetricRecordFromJSON)),
39
40
  };
40
41
  }
41
42
  exports.ProjectMetricsFromJSONTyped = ProjectMetricsFromJSONTyped;
@@ -48,8 +49,8 @@ function ProjectMetricsToJSON(value) {
48
49
  }
49
50
  return {
50
51
  'projectId': value.projectId,
51
- 'costs': value.costs,
52
- 'storageMetrics': value.storageMetrics,
52
+ 'costs': value.costs === undefined ? undefined : (value.costs.map(MetricRecord_1.MetricRecordToJSON)),
53
+ 'storageMetrics': value.storageMetrics === undefined ? undefined : (value.storageMetrics.map(MetricRecord_1.MetricRecordToJSON)),
53
54
  };
54
55
  }
55
56
  exports.ProjectMetricsToJSON = ProjectMetricsToJSON;
@@ -54,13 +54,13 @@ export interface ProjectRequest {
54
54
  * @type {CloudAccount}
55
55
  * @memberof ProjectRequest
56
56
  */
57
- account: CloudAccount;
57
+ account: CloudAccount | null;
58
58
  /**
59
59
  *
60
60
  * @type {Array<Tag>}
61
61
  * @memberof ProjectRequest
62
62
  */
63
- tags: Array<Tag>;
63
+ tags: Array<Tag> | null;
64
64
  }
65
65
  /**
66
66
  * Check if a given object implements the ProjectRequest interface.
@@ -48,7 +48,7 @@ function ProjectRequestFromJSONTyped(json, ignoreDiscriminator) {
48
48
  'settings': (0, ProjectSettings_1.ProjectSettingsFromJSON)(json['settings']),
49
49
  'contacts': (json['contacts'].map(Contact_1.ContactFromJSON)),
50
50
  'account': (0, CloudAccount_1.CloudAccountFromJSON)(json['account']),
51
- 'tags': (json['tags'].map(Tag_1.TagFromJSON)),
51
+ 'tags': (json['tags'] === null ? null : json['tags'].map(Tag_1.TagFromJSON)),
52
52
  };
53
53
  }
54
54
  exports.ProjectRequestFromJSONTyped = ProjectRequestFromJSONTyped;
@@ -66,7 +66,7 @@ function ProjectRequestToJSON(value) {
66
66
  'settings': (0, ProjectSettings_1.ProjectSettingsToJSON)(value.settings),
67
67
  'contacts': (value.contacts.map(Contact_1.ContactToJSON)),
68
68
  'account': (0, CloudAccount_1.CloudAccountToJSON)(value.account),
69
- 'tags': (value.tags.map(Tag_1.TagToJSON)),
69
+ 'tags': (value.tags === null ? null : value.tags.map(Tag_1.TagToJSON)),
70
70
  };
71
71
  }
72
72
  exports.ProjectRequestToJSON = ProjectRequestToJSON;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Cirro Data
3
+ * Cirro Data Platform service API
4
+ *
5
+ * The version of the OpenAPI document: latest
6
+ * Contact: support@cirro.bio
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { ProjectRole } from './ProjectRole';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface ProjectUser
17
+ */
18
+ export interface ProjectUser {
19
+ /**
20
+ *
21
+ * @type {string}
22
+ * @memberof ProjectUser
23
+ */
24
+ name: string;
25
+ /**
26
+ *
27
+ * @type {string}
28
+ * @memberof ProjectUser
29
+ */
30
+ username: string;
31
+ /**
32
+ *
33
+ * @type {string}
34
+ * @memberof ProjectUser
35
+ */
36
+ organization: string;
37
+ /**
38
+ *
39
+ * @type {string}
40
+ * @memberof ProjectUser
41
+ */
42
+ department: string;
43
+ /**
44
+ *
45
+ * @type {string}
46
+ * @memberof ProjectUser
47
+ */
48
+ email: string;
49
+ /**
50
+ *
51
+ * @type {ProjectRole}
52
+ * @memberof ProjectUser
53
+ */
54
+ role: ProjectRole;
55
+ }
56
+ /**
57
+ * Check if a given object implements the ProjectUser interface.
58
+ */
59
+ export declare function instanceOfProjectUser(value: object): boolean;
60
+ export declare function ProjectUserFromJSON(json: any): ProjectUser;
61
+ export declare function ProjectUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProjectUser;
62
+ export declare function ProjectUserToJSON(value?: ProjectUser | null): any;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Cirro Data
6
+ * Cirro Data Platform service API
7
+ *
8
+ * The version of the OpenAPI document: latest
9
+ * Contact: support@cirro.bio
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ProjectUserToJSON = exports.ProjectUserFromJSONTyped = exports.ProjectUserFromJSON = exports.instanceOfProjectUser = void 0;
17
+ var ProjectRole_1 = require("./ProjectRole");
18
+ /**
19
+ * Check if a given object implements the ProjectUser interface.
20
+ */
21
+ function instanceOfProjectUser(value) {
22
+ var isInstance = true;
23
+ isInstance = isInstance && "name" in value;
24
+ isInstance = isInstance && "username" in value;
25
+ isInstance = isInstance && "organization" in value;
26
+ isInstance = isInstance && "department" in value;
27
+ isInstance = isInstance && "email" in value;
28
+ isInstance = isInstance && "role" in value;
29
+ return isInstance;
30
+ }
31
+ exports.instanceOfProjectUser = instanceOfProjectUser;
32
+ function ProjectUserFromJSON(json) {
33
+ return ProjectUserFromJSONTyped(json, false);
34
+ }
35
+ exports.ProjectUserFromJSON = ProjectUserFromJSON;
36
+ function ProjectUserFromJSONTyped(json, ignoreDiscriminator) {
37
+ if ((json === undefined) || (json === null)) {
38
+ return json;
39
+ }
40
+ return {
41
+ 'name': json['name'],
42
+ 'username': json['username'],
43
+ 'organization': json['organization'],
44
+ 'department': json['department'],
45
+ 'email': json['email'],
46
+ 'role': (0, ProjectRole_1.ProjectRoleFromJSON)(json['role']),
47
+ };
48
+ }
49
+ exports.ProjectUserFromJSONTyped = ProjectUserFromJSONTyped;
50
+ function ProjectUserToJSON(value) {
51
+ if (value === undefined) {
52
+ return undefined;
53
+ }
54
+ if (value === null) {
55
+ return null;
56
+ }
57
+ return {
58
+ 'name': value.name,
59
+ 'username': value.username,
60
+ 'organization': value.organization,
61
+ 'department': value.department,
62
+ 'email': value.email,
63
+ 'role': (0, ProjectRole_1.ProjectRoleToJSON)(value.role),
64
+ };
65
+ }
66
+ exports.ProjectUserToJSON = ProjectUserToJSON;
@@ -27,6 +27,12 @@ export interface Tag {
27
27
  * @memberof Tag
28
28
  */
29
29
  value: string;
30
+ /**
31
+ *
32
+ * @type {boolean}
33
+ * @memberof Tag
34
+ */
35
+ editable: boolean;
30
36
  }
31
37
  /**
32
38
  * Check if a given object implements the Tag interface.
@@ -21,6 +21,7 @@ function instanceOfTag(value) {
21
21
  var isInstance = true;
22
22
  isInstance = isInstance && "key" in value;
23
23
  isInstance = isInstance && "value" in value;
24
+ isInstance = isInstance && "editable" in value;
24
25
  return isInstance;
25
26
  }
26
27
  exports.instanceOfTag = instanceOfTag;
@@ -35,6 +36,7 @@ function TagFromJSONTyped(json, ignoreDiscriminator) {
35
36
  return {
36
37
  'key': json['key'],
37
38
  'value': json['value'],
39
+ 'editable': json['editable'],
38
40
  };
39
41
  }
40
42
  exports.TagFromJSONTyped = TagFromJSONTyped;
@@ -48,6 +50,7 @@ function TagToJSON(value) {
48
50
  return {
49
51
  'key': value.key,
50
52
  'value': value.value,
53
+ 'editable': value.editable,
51
54
  };
52
55
  }
53
56
  exports.TagToJSON = TagToJSON;
@@ -14,6 +14,7 @@ export * from './Executor';
14
14
  export * from './FormSchema';
15
15
  export * from './GetExecutionLogsResponse';
16
16
  export * from './LogEntry';
17
+ export * from './MetricRecord';
17
18
  export * from './NotebookInstance';
18
19
  export * from './OpenNotebookInstanceResponse';
19
20
  export * from './Process';
@@ -24,6 +25,7 @@ export * from './ProjectMetrics';
24
25
  export * from './ProjectRequest';
25
26
  export * from './ProjectRole';
26
27
  export * from './ProjectSettings';
28
+ export * from './ProjectUser';
27
29
  export * from './Reference';
28
30
  export * from './ReferenceType';
29
31
  export * from './Region';
@@ -32,6 +32,7 @@ __exportStar(require("./Executor"), exports);
32
32
  __exportStar(require("./FormSchema"), exports);
33
33
  __exportStar(require("./GetExecutionLogsResponse"), exports);
34
34
  __exportStar(require("./LogEntry"), exports);
35
+ __exportStar(require("./MetricRecord"), exports);
35
36
  __exportStar(require("./NotebookInstance"), exports);
36
37
  __exportStar(require("./OpenNotebookInstanceResponse"), exports);
37
38
  __exportStar(require("./Process"), exports);
@@ -42,6 +43,7 @@ __exportStar(require("./ProjectMetrics"), exports);
42
43
  __exportStar(require("./ProjectRequest"), exports);
43
44
  __exportStar(require("./ProjectRole"), exports);
44
45
  __exportStar(require("./ProjectSettings"), exports);
46
+ __exportStar(require("./ProjectUser"), exports);
45
47
  __exportStar(require("./Reference"), exports);
46
48
  __exportStar(require("./ReferenceType"), exports);
47
49
  __exportStar(require("./Region"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cirrobio/api-client",
3
- "version": "0.0.7-alpha",
3
+ "version": "0.0.8-alpha",
4
4
  "description": "API client for Cirro",
5
5
  "author": "CirroBio",
6
6
  "repository": {
@@ -31,6 +31,42 @@ export interface GetProjectMetricsRequest {
31
31
  */
32
32
  export class MetricsApi extends runtime.BaseAPI {
33
33
 
34
+ /**
35
+ * Retrieves metrics for all projects.
36
+ * Get all project metrics
37
+ */
38
+ async getAllMetricsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMetrics>>> {
39
+ const queryParameters: any = {};
40
+
41
+ const headerParameters: runtime.HTTPHeaders = {};
42
+
43
+ if (this.configuration && this.configuration.accessToken) {
44
+ const token = this.configuration.accessToken;
45
+ const tokenString = await token("accessToken", []);
46
+
47
+ if (tokenString) {
48
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
49
+ }
50
+ }
51
+ const response = await this.request({
52
+ path: `/metrics`,
53
+ method: 'GET',
54
+ headers: headerParameters,
55
+ query: queryParameters,
56
+ }, initOverrides);
57
+
58
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ProjectMetricsFromJSON));
59
+ }
60
+
61
+ /**
62
+ * Retrieves metrics for all projects.
63
+ * Get all project metrics
64
+ */
65
+ async getAllMetrics(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMetrics>> {
66
+ const response = await this.getAllMetricsRaw(initOverrides);
67
+ return await response.value();
68
+ }
69
+
34
70
  /**
35
71
  * Retrieves metrics about a project.
36
72
  * Get project metrics
@@ -19,6 +19,7 @@ import type {
19
19
  Project,
20
20
  ProjectDetail,
21
21
  ProjectRequest,
22
+ ProjectUser,
22
23
  SetUserProjectRoleRequest,
23
24
  Tag,
24
25
  } from '../models/index';
@@ -31,6 +32,8 @@ import {
31
32
  ProjectDetailToJSON,
32
33
  ProjectRequestFromJSON,
33
34
  ProjectRequestToJSON,
35
+ ProjectUserFromJSON,
36
+ ProjectUserToJSON,
34
37
  SetUserProjectRoleRequestFromJSON,
35
38
  SetUserProjectRoleRequestToJSON,
36
39
  TagFromJSON,
@@ -45,6 +48,10 @@ export interface GetProjectRequest {
45
48
  projectId: string;
46
49
  }
47
50
 
51
+ export interface GetProjectUsersRequest {
52
+ projectId: string;
53
+ }
54
+
48
55
  export interface SetUserProjectRoleOperationRequest {
49
56
  projectId: string;
50
57
  username: string;
@@ -149,6 +156,46 @@ export class ProjectsApi extends runtime.BaseAPI {
149
156
  return await response.value();
150
157
  }
151
158
 
159
+ /**
160
+ * Gets users who have access to the project
161
+ * Get project permissions
162
+ */
163
+ async getProjectUsersRaw(requestParameters: GetProjectUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectUser>>> {
164
+ if (requestParameters.projectId === null || requestParameters.projectId === undefined) {
165
+ throw new runtime.RequiredError('projectId','Required parameter requestParameters.projectId was null or undefined when calling getProjectUsers.');
166
+ }
167
+
168
+ const queryParameters: any = {};
169
+
170
+ const headerParameters: runtime.HTTPHeaders = {};
171
+
172
+ if (this.configuration && this.configuration.accessToken) {
173
+ const token = this.configuration.accessToken;
174
+ const tokenString = await token("accessToken", []);
175
+
176
+ if (tokenString) {
177
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
178
+ }
179
+ }
180
+ const response = await this.request({
181
+ path: `/projects/{projectId}/permissions`.replace(`{${"projectId"}}`, encodeURIComponent(String(requestParameters.projectId))),
182
+ method: 'GET',
183
+ headers: headerParameters,
184
+ query: queryParameters,
185
+ }, initOverrides);
186
+
187
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(ProjectUserFromJSON));
188
+ }
189
+
190
+ /**
191
+ * Gets users who have access to the project
192
+ * Get project permissions
193
+ */
194
+ async getProjectUsers(requestParameters: GetProjectUsersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectUser>> {
195
+ const response = await this.getProjectUsersRaw(requestParameters, initOverrides);
196
+ return await response.value();
197
+ }
198
+
152
199
  /**
153
200
  * Retrieve a list of projects
154
201
  * Get projects
@@ -0,0 +1,83 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Cirro Data
5
+ * Cirro Data Platform service API
6
+ *
7
+ * The version of the OpenAPI document: latest
8
+ * Contact: support@cirro.bio
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
+ import { exists, mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface MetricRecord
20
+ */
21
+ export interface MetricRecord {
22
+ /**
23
+ *
24
+ * @type {Date}
25
+ * @memberof MetricRecord
26
+ */
27
+ date: Date;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof MetricRecord
32
+ */
33
+ unit: string;
34
+ /**
35
+ * Map of service names to metric value
36
+ * @type {{ [key: string]: number; }}
37
+ * @memberof MetricRecord
38
+ */
39
+ services?: { [key: string]: number; };
40
+ }
41
+
42
+ /**
43
+ * Check if a given object implements the MetricRecord interface.
44
+ */
45
+ export function instanceOfMetricRecord(value: object): boolean {
46
+ let isInstance = true;
47
+ isInstance = isInstance && "date" in value;
48
+ isInstance = isInstance && "unit" in value;
49
+
50
+ return isInstance;
51
+ }
52
+
53
+ export function MetricRecordFromJSON(json: any): MetricRecord {
54
+ return MetricRecordFromJSONTyped(json, false);
55
+ }
56
+
57
+ export function MetricRecordFromJSONTyped(json: any, ignoreDiscriminator: boolean): MetricRecord {
58
+ if ((json === undefined) || (json === null)) {
59
+ return json;
60
+ }
61
+ return {
62
+
63
+ 'date': (new Date(json['date'])),
64
+ 'unit': json['unit'],
65
+ 'services': !exists(json, 'services') ? undefined : json['services'],
66
+ };
67
+ }
68
+
69
+ export function MetricRecordToJSON(value?: MetricRecord | null): any {
70
+ if (value === undefined) {
71
+ return undefined;
72
+ }
73
+ if (value === null) {
74
+ return null;
75
+ }
76
+ return {
77
+
78
+ 'date': (value.date.toISOString().substring(0,10)),
79
+ 'unit': value.unit,
80
+ 'services': value.services,
81
+ };
82
+ }
83
+
@@ -13,6 +13,13 @@
13
13
  */
14
14
 
15
15
  import { exists, mapValues } from '../runtime';
16
+ import type { MetricRecord } from './MetricRecord';
17
+ import {
18
+ MetricRecordFromJSON,
19
+ MetricRecordFromJSONTyped,
20
+ MetricRecordToJSON,
21
+ } from './MetricRecord';
22
+
16
23
  /**
17
24
  *
18
25
  * @export
@@ -27,16 +34,16 @@ export interface ProjectMetrics {
27
34
  projectId: string;
28
35
  /**
29
36
  * Costs by service by month
30
- * @type {{ [key: string]: { [key: string]: number; }; }}
37
+ * @type {Array<MetricRecord>}
31
38
  * @memberof ProjectMetrics
32
39
  */
33
- costs?: { [key: string]: { [key: string]: number; }; };
40
+ costs?: Array<MetricRecord>;
34
41
  /**
35
42
  * Storage usage by tier by day
36
- * @type {{ [key: string]: any; }}
43
+ * @type {Array<MetricRecord>}
37
44
  * @memberof ProjectMetrics
38
45
  */
39
- storageMetrics?: { [key: string]: any; };
46
+ storageMetrics?: Array<MetricRecord>;
40
47
  }
41
48
 
42
49
  /**
@@ -60,8 +67,8 @@ export function ProjectMetricsFromJSONTyped(json: any, ignoreDiscriminator: bool
60
67
  return {
61
68
 
62
69
  'projectId': json['projectId'],
63
- 'costs': !exists(json, 'costs') ? undefined : json['costs'],
64
- 'storageMetrics': !exists(json, 'storageMetrics') ? undefined : json['storageMetrics'],
70
+ 'costs': !exists(json, 'costs') ? undefined : ((json['costs'] as Array<any>).map(MetricRecordFromJSON)),
71
+ 'storageMetrics': !exists(json, 'storageMetrics') ? undefined : ((json['storageMetrics'] as Array<any>).map(MetricRecordFromJSON)),
65
72
  };
66
73
  }
67
74
 
@@ -75,8 +82,8 @@ export function ProjectMetricsToJSON(value?: ProjectMetrics | null): any {
75
82
  return {
76
83
 
77
84
  'projectId': value.projectId,
78
- 'costs': value.costs,
79
- 'storageMetrics': value.storageMetrics,
85
+ 'costs': value.costs === undefined ? undefined : ((value.costs as Array<any>).map(MetricRecordToJSON)),
86
+ 'storageMetrics': value.storageMetrics === undefined ? undefined : ((value.storageMetrics as Array<any>).map(MetricRecordToJSON)),
80
87
  };
81
88
  }
82
89
 
@@ -79,13 +79,13 @@ export interface ProjectRequest {
79
79
  * @type {CloudAccount}
80
80
  * @memberof ProjectRequest
81
81
  */
82
- account: CloudAccount;
82
+ account: CloudAccount | null;
83
83
  /**
84
84
  *
85
85
  * @type {Array<Tag>}
86
86
  * @memberof ProjectRequest
87
87
  */
88
- tags: Array<Tag>;
88
+ tags: Array<Tag> | null;
89
89
  }
90
90
 
91
91
  /**
@@ -120,7 +120,7 @@ export function ProjectRequestFromJSONTyped(json: any, ignoreDiscriminator: bool
120
120
  'settings': ProjectSettingsFromJSON(json['settings']),
121
121
  'contacts': ((json['contacts'] as Array<any>).map(ContactFromJSON)),
122
122
  'account': CloudAccountFromJSON(json['account']),
123
- 'tags': ((json['tags'] as Array<any>).map(TagFromJSON)),
123
+ 'tags': (json['tags'] === null ? null : (json['tags'] as Array<any>).map(TagFromJSON)),
124
124
  };
125
125
  }
126
126
 
@@ -139,7 +139,7 @@ export function ProjectRequestToJSON(value?: ProjectRequest | null): any {
139
139
  'settings': ProjectSettingsToJSON(value.settings),
140
140
  'contacts': ((value.contacts as Array<any>).map(ContactToJSON)),
141
141
  'account': CloudAccountToJSON(value.account),
142
- 'tags': ((value.tags as Array<any>).map(TagToJSON)),
142
+ 'tags': (value.tags === null ? null : (value.tags as Array<any>).map(TagToJSON)),
143
143
  };
144
144
  }
145
145
 
@@ -0,0 +1,118 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Cirro Data
5
+ * Cirro Data Platform service API
6
+ *
7
+ * The version of the OpenAPI document: latest
8
+ * Contact: support@cirro.bio
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
+ import { exists, mapValues } from '../runtime';
16
+ import type { ProjectRole } from './ProjectRole';
17
+ import {
18
+ ProjectRoleFromJSON,
19
+ ProjectRoleFromJSONTyped,
20
+ ProjectRoleToJSON,
21
+ } from './ProjectRole';
22
+
23
+ /**
24
+ *
25
+ * @export
26
+ * @interface ProjectUser
27
+ */
28
+ export interface ProjectUser {
29
+ /**
30
+ *
31
+ * @type {string}
32
+ * @memberof ProjectUser
33
+ */
34
+ name: string;
35
+ /**
36
+ *
37
+ * @type {string}
38
+ * @memberof ProjectUser
39
+ */
40
+ username: string;
41
+ /**
42
+ *
43
+ * @type {string}
44
+ * @memberof ProjectUser
45
+ */
46
+ organization: string;
47
+ /**
48
+ *
49
+ * @type {string}
50
+ * @memberof ProjectUser
51
+ */
52
+ department: string;
53
+ /**
54
+ *
55
+ * @type {string}
56
+ * @memberof ProjectUser
57
+ */
58
+ email: string;
59
+ /**
60
+ *
61
+ * @type {ProjectRole}
62
+ * @memberof ProjectUser
63
+ */
64
+ role: ProjectRole;
65
+ }
66
+
67
+ /**
68
+ * Check if a given object implements the ProjectUser interface.
69
+ */
70
+ export function instanceOfProjectUser(value: object): boolean {
71
+ let isInstance = true;
72
+ isInstance = isInstance && "name" in value;
73
+ isInstance = isInstance && "username" in value;
74
+ isInstance = isInstance && "organization" in value;
75
+ isInstance = isInstance && "department" in value;
76
+ isInstance = isInstance && "email" in value;
77
+ isInstance = isInstance && "role" in value;
78
+
79
+ return isInstance;
80
+ }
81
+
82
+ export function ProjectUserFromJSON(json: any): ProjectUser {
83
+ return ProjectUserFromJSONTyped(json, false);
84
+ }
85
+
86
+ export function ProjectUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProjectUser {
87
+ if ((json === undefined) || (json === null)) {
88
+ return json;
89
+ }
90
+ return {
91
+
92
+ 'name': json['name'],
93
+ 'username': json['username'],
94
+ 'organization': json['organization'],
95
+ 'department': json['department'],
96
+ 'email': json['email'],
97
+ 'role': ProjectRoleFromJSON(json['role']),
98
+ };
99
+ }
100
+
101
+ export function ProjectUserToJSON(value?: ProjectUser | null): any {
102
+ if (value === undefined) {
103
+ return undefined;
104
+ }
105
+ if (value === null) {
106
+ return null;
107
+ }
108
+ return {
109
+
110
+ 'name': value.name,
111
+ 'username': value.username,
112
+ 'organization': value.organization,
113
+ 'department': value.department,
114
+ 'email': value.email,
115
+ 'role': ProjectRoleToJSON(value.role),
116
+ };
117
+ }
118
+
package/src/models/Tag.ts CHANGED
@@ -31,6 +31,12 @@ export interface Tag {
31
31
  * @memberof Tag
32
32
  */
33
33
  value: string;
34
+ /**
35
+ *
36
+ * @type {boolean}
37
+ * @memberof Tag
38
+ */
39
+ editable: boolean;
34
40
  }
35
41
 
36
42
  /**
@@ -40,6 +46,7 @@ export function instanceOfTag(value: object): boolean {
40
46
  let isInstance = true;
41
47
  isInstance = isInstance && "key" in value;
42
48
  isInstance = isInstance && "value" in value;
49
+ isInstance = isInstance && "editable" in value;
43
50
 
44
51
  return isInstance;
45
52
  }
@@ -56,6 +63,7 @@ export function TagFromJSONTyped(json: any, ignoreDiscriminator: boolean): Tag {
56
63
 
57
64
  'key': json['key'],
58
65
  'value': json['value'],
66
+ 'editable': json['editable'],
59
67
  };
60
68
  }
61
69
 
@@ -70,6 +78,7 @@ export function TagToJSON(value?: Tag | null): any {
70
78
 
71
79
  'key': value.key,
72
80
  'value': value.value,
81
+ 'editable': value.editable,
73
82
  };
74
83
  }
75
84
 
@@ -16,6 +16,7 @@ export * from './Executor';
16
16
  export * from './FormSchema';
17
17
  export * from './GetExecutionLogsResponse';
18
18
  export * from './LogEntry';
19
+ export * from './MetricRecord';
19
20
  export * from './NotebookInstance';
20
21
  export * from './OpenNotebookInstanceResponse';
21
22
  export * from './Process';
@@ -26,6 +27,7 @@ export * from './ProjectMetrics';
26
27
  export * from './ProjectRequest';
27
28
  export * from './ProjectRole';
28
29
  export * from './ProjectSettings';
30
+ export * from './ProjectUser';
29
31
  export * from './Reference';
30
32
  export * from './ReferenceType';
31
33
  export * from './Region';