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+ }
0 commit comments