Skip to content

Commit 3a06ff0

Browse files
committed
codegen v2
1 parent 2251702 commit 3a06ff0

File tree

11 files changed

+171
-18
lines changed

11 files changed

+171
-18
lines changed

frontend/src/openapi/v2/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export { ApiError } from './core/ApiError';
55
export { CancelablePromise } from './core/CancelablePromise';
66
export { OpenAPI } from './core/OpenAPI';
77

8+
export type { AuthorizationBase } from './models/AuthorizationBase';
9+
export type { AuthorizationDB } from './models/AuthorizationDB';
810
export type { Body_create_dataset_from_zip_api_v2_datasets_createFromZip_post } from './models/Body_create_dataset_from_zip_api_v2_datasets_createFromZip_post';
911
export type { Body_get_dataset_metadata_api_v2_datasets__dataset_id__metadata_get } from './models/Body_get_dataset_metadata_api_v2_datasets__dataset_id__metadata_get';
1012
export type { Body_get_file_metadata_api_v2_files__file_id__metadata_get } from './models/Body_get_file_metadata_api_v2_files__file_id__metadata_get';
@@ -21,6 +23,7 @@ export type { ExtractorInfo } from './models/ExtractorInfo';
2123
export type { FeedIn } from './models/FeedIn';
2224
export type { FeedListener } from './models/FeedListener';
2325
export type { FeedOut } from './models/FeedOut';
26+
export type { FileContentType } from './models/FileContentType';
2427
export type { FileOut } from './models/FileOut';
2528
export type { FileVersion } from './models/FileVersion';
2629
export type { FolderIn } from './models/FolderIn';
@@ -39,6 +42,7 @@ export type { MetadataOut } from './models/MetadataOut';
3942
export type { MetadataPatch } from './models/MetadataPatch';
4043
export type { MongoDBRef } from './models/MongoDBRef';
4144
export type { Repository } from './models/Repository';
45+
export { RoleType } from './models/RoleType';
4246
export type { SearchCriteria } from './models/SearchCriteria';
4347
export type { SearchObject } from './models/SearchObject';
4448
export type { UserIn } from './models/UserIn';
@@ -47,6 +51,7 @@ export type { UserOut } from './models/UserOut';
4751
export type { ValidationError } from './models/ValidationError';
4852

4953
export { AuthService } from './services/AuthService';
54+
export { AuthorizationService } from './services/AuthorizationService';
5055
export { DatasetsService } from './services/DatasetsService';
5156
export { ElasticsearchService } from './services/ElasticsearchService';
5257
export { ExtractorsService } from './services/ExtractorsService';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
import type { RoleType } from './RoleType';
6+
7+
export type AuthorizationBase = {
8+
dataset_id: string;
9+
user_id: string;
10+
role: RoleType;
11+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
import type { RoleType } from './RoleType';
6+
7+
/**
8+
* Store user who created model, when and last time it was updated.
9+
* TODO: this generic model should be moved to a global util module in models for all those models that want to
10+
* store basic provenance.
11+
*/
12+
export type AuthorizationDB = {
13+
creator: string;
14+
created?: string;
15+
modified?: string;
16+
dataset_id: string;
17+
user_id: string;
18+
role: RoleType;
19+
id?: string;
20+
}

frontend/src/openapi/v2/models/FeedOut.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ export type FeedOut = {
1515
name: string;
1616
search: SearchObject;
1717
listeners?: Array<FeedListener>;
18-
author: UserOut;
18+
author?: UserOut;
1919
updated?: string;
2020
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
/**
6+
* This model describes the content type of a file uploaded to Clowder. A typical example is "text/plain" for .txt.
7+
* In Clowder v1 extractors, "text/*" syntax is acceptable for wildcard matches. To support this, the content type is
8+
* split into main ("text") and secondary ("plain") parts so the dynamic matching with * can still be done.
9+
*/
10+
export type FileContentType = {
11+
content_type?: string;
12+
main_type?: string;
13+
}

frontend/src/openapi/v2/models/FileOut.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* tslint:disable */
33
/* eslint-disable */
44

5+
import type { FileContentType } from './FileContentType';
56
import type { UserOut } from './UserOut';
67

78
export type FileOut = {
@@ -16,5 +17,5 @@ export type FileOut = {
1617
views?: number;
1718
downloads?: number;
1819
bytes?: number;
19-
content_type?: string;
20+
content_type?: FileContentType;
2021
}

frontend/src/openapi/v2/models/FileVersion.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* tslint:disable */
33
/* eslint-disable */
44

5+
import type { FileContentType } from './FileContentType';
56
import type { UserOut } from './UserOut';
67

78
export type FileVersion = {
@@ -11,6 +12,6 @@ export type FileVersion = {
1112
file_id: string;
1213
creator: UserOut;
1314
bytes?: number;
14-
content_type?: string;
15+
content_type?: FileContentType;
1516
created?: string;
1617
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
5+
/**
6+
* A user can have one of the following roles for a specific dataset. Since we don't currently implement permissions
7+
* there is an implied hierarchy between these roles OWNER > EDITOR > UPLOADER > VIEWER. For example, if a route
8+
* requires VIEWER any of the roles can access that resource.
9+
*/
10+
export enum RoleType {
11+
OWNER = 'owner',
12+
VIEWER = 'viewer',
13+
UPLOADER = 'uploader',
14+
EDITOR = 'editor',
15+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
/* istanbul ignore file */
2+
/* tslint:disable */
3+
/* eslint-disable */
4+
import type { AuthorizationBase } from '../models/AuthorizationBase';
5+
import type { AuthorizationDB } from '../models/AuthorizationDB';
6+
import type { CancelablePromise } from '../core/CancelablePromise';
7+
import { request as __request } from '../core/request';
8+
9+
export class AuthorizationService {
10+
11+
/**
12+
* Save Authorization
13+
* Save authorization info in Mongo. This is a triple of dataset_id/user_id/role.
14+
* @param requestBody
15+
* @returns AuthorizationDB Successful Response
16+
* @throws ApiError
17+
*/
18+
public static saveAuthorizationApiV2AuthorizationsPost(
19+
requestBody: AuthorizationBase,
20+
): CancelablePromise<AuthorizationDB> {
21+
return __request({
22+
method: 'POST',
23+
path: `/api/v2/authorizations`,
24+
body: requestBody,
25+
mediaType: 'application/json',
26+
errors: {
27+
422: `Validation Error`,
28+
},
29+
});
30+
}
31+
32+
/**
33+
* Get Dataset Role
34+
* Retrieve role of user for a specific dataset.
35+
* @param datasetId
36+
* @returns AuthorizationBase Successful Response
37+
* @throws ApiError
38+
*/
39+
public static getDatasetRoleApiV2AuthorizationsDatasetsDatasetIdRoleGet(
40+
datasetId: string,
41+
): CancelablePromise<AuthorizationBase> {
42+
return __request({
43+
method: 'GET',
44+
path: `/api/v2/authorizations/datasets/${datasetId}/role`,
45+
errors: {
46+
422: `Validation Error`,
47+
},
48+
});
49+
}
50+
51+
/**
52+
* Get Dataset Role Viewer
53+
* Used for testing only. Returns true if user has viewer permission on dataset, otherwise throws a 403 Forbidden HTTP exception.
54+
* See `routers/authorization.py` for more info.
55+
* @param datasetId
56+
* @returns any Successful Response
57+
* @throws ApiError
58+
*/
59+
public static getDatasetRoleViewerApiV2AuthorizationsDatasetsDatasetIdRoleViewerGet(
60+
datasetId: string,
61+
): CancelablePromise<any> {
62+
return __request({
63+
method: 'GET',
64+
path: `/api/v2/authorizations/datasets/${datasetId}/role/viewer`,
65+
errors: {
66+
422: `Validation Error`,
67+
},
68+
});
69+
}
70+
71+
/**
72+
* Get Dataset Role Owner
73+
* Used for testing only. Returns true if user has owner permission on dataset, otherwise throws a 403 Forbidden HTTP exception.
74+
* See `routers/authorization.py` for more info.
75+
* @param datasetId
76+
* @returns any Successful Response
77+
* @throws ApiError
78+
*/
79+
public static getDatasetRoleOwnerApiV2AuthorizationsDatasetsDatasetIdRoleOwnerGet(
80+
datasetId: string,
81+
): CancelablePromise<any> {
82+
return __request({
83+
method: 'GET',
84+
path: `/api/v2/authorizations/datasets/${datasetId}/role/owner`,
85+
errors: {
86+
422: `Validation Error`,
87+
},
88+
});
89+
}
90+
91+
}

frontend/src/openapi/v2/services/FilesService.ts

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,30 +112,26 @@ export class FilesService {
112112
}
113113

114114
/**
115-
* Get File Extract
116-
* Submit file to an extractor.
115+
* Resubmit File Extractions
116+
* This route will check metadata. We get the extractors run from metadata from extractors.
117+
* Then they are resubmitted. At present parameters are not stored. This will change once Jobs are
118+
* implemented.
117119
*
118-
* :param file_id: UUID of file
119-
* :param info: must include "extractor" field with name, can also include key/value pairs in "parameters"
120+
* Arguments:
121+
* file_id: Id of file
122+
* credentials: credentials of logged in user
123+
* db: MongoDB Client
124+
* rabbitmq_client: Rabbitmq Client
120125
* @param fileId
121-
* @param extractorName
122-
* @param requestBody
123126
* @returns any Successful Response
124127
* @throws ApiError
125128
*/
126-
public static getFileExtractApiV2FilesFileIdExtractPost(
129+
public static resubmitFileExtractionsApiV2FilesFileIdExtractPost(
127130
fileId: string,
128-
extractorName: string,
129-
requestBody?: any,
130131
): CancelablePromise<any> {
131132
return __request({
132133
method: 'POST',
133134
path: `/api/v2/files/${fileId}/extract`,
134-
query: {
135-
'extractorName': extractorName,
136-
},
137-
body: requestBody,
138-
mediaType: 'application/json',
139135
errors: {
140136
422: `Validation Error`,
141137
},

0 commit comments

Comments
 (0)