UNPKG

cwmsjs

Version:

CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps

222 lines (177 loc) 8.47 kB
/* tslint:disable */ /* eslint-disable */ /** * CWMS Data API * CWMS REST API for Data Retrieval * * The version of the OpenAPI document: 2.4.0-2026.3.16 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import { CdaError, CdaErrorFromJSON, CdaErrorToJSON, LockRevokerRights, LockRevokerRightsFromJSON, LockRevokerRightsToJSON, } from '../models'; export interface GetProjectLockRightsRequest { officeMask: string; projectMask?: string; applicationMask?: string; } export interface PostProjectLockRightsRemoveAllRequest { office: string; applicationId: string; userId: string; } export interface PostProjectLockRightsUpdateRequest { office: string; applicationId: string; userId: string; allow: boolean; projectMask?: string; } /** * */ export class ProjectLockRevokerRightsApi extends runtime.BaseAPI { /** * Get a list of project lock revoker rights * Get projectLockRights */ async getProjectLockRightsRaw(requestParameters: GetProjectLockRightsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Array<LockRevokerRights>>> { if (requestParameters.officeMask === null || requestParameters.officeMask === undefined) { throw new runtime.RequiredError('officeMask','Required parameter requestParameters.officeMask was null or undefined when calling getProjectLockRights.'); } const queryParameters: any = {}; if (requestParameters.officeMask !== undefined) { queryParameters['office-mask'] = requestParameters.officeMask; } if (requestParameters.projectMask !== undefined) { queryParameters['project-mask'] = requestParameters.projectMask; } if (requestParameters.applicationMask !== undefined) { queryParameters['application-mask'] = requestParameters.applicationMask; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/project-lock-rights`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(LockRevokerRightsFromJSON)); } /** * Get a list of project lock revoker rights * Get projectLockRights */ async getProjectLockRights(requestParameters: GetProjectLockRightsRequest, initOverrides?: RequestInit): Promise<Array<LockRevokerRights>> { const response = await this.getProjectLockRightsRaw(requestParameters, initOverrides); return await response.value(); } /** * Revokes a project lock, if successful the lock is deleted * Post projectLockRights removeAll */ async postProjectLockRightsRemoveAllRaw(requestParameters: PostProjectLockRightsRemoveAllRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling postProjectLockRightsRemoveAll.'); } if (requestParameters.applicationId === null || requestParameters.applicationId === undefined) { throw new runtime.RequiredError('applicationId','Required parameter requestParameters.applicationId was null or undefined when calling postProjectLockRightsRemoveAll.'); } if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling postProjectLockRightsRemoveAll.'); } const queryParameters: any = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.applicationId !== undefined) { queryParameters['application-id'] = requestParameters.applicationId; } if (requestParameters.userId !== undefined) { queryParameters['user-id'] = requestParameters.userId; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/project-lock-rights/remove-all`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Revokes a project lock, if successful the lock is deleted * Post projectLockRights removeAll */ async postProjectLockRightsRemoveAll(requestParameters: PostProjectLockRightsRemoveAllRequest, initOverrides?: RequestInit): Promise<void> { await this.postProjectLockRightsRemoveAllRaw(requestParameters, initOverrides); } /** * Update Lock Revoker Rights. * Post projectLockRights update */ async postProjectLockRightsUpdateRaw(requestParameters: PostProjectLockRightsUpdateRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling postProjectLockRightsUpdate.'); } if (requestParameters.applicationId === null || requestParameters.applicationId === undefined) { throw new runtime.RequiredError('applicationId','Required parameter requestParameters.applicationId was null or undefined when calling postProjectLockRightsUpdate.'); } if (requestParameters.userId === null || requestParameters.userId === undefined) { throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling postProjectLockRightsUpdate.'); } if (requestParameters.allow === null || requestParameters.allow === undefined) { throw new runtime.RequiredError('allow','Required parameter requestParameters.allow was null or undefined when calling postProjectLockRightsUpdate.'); } const queryParameters: any = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.projectMask !== undefined) { queryParameters['project-mask'] = requestParameters.projectMask; } if (requestParameters.applicationId !== undefined) { queryParameters['application-id'] = requestParameters.applicationId; } if (requestParameters.userId !== undefined) { queryParameters['user-id'] = requestParameters.userId; } if (requestParameters.allow !== undefined) { queryParameters['allow'] = requestParameters.allow; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/project-lock-rights/update`, method: 'POST', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Update Lock Revoker Rights. * Post projectLockRights update */ async postProjectLockRightsUpdate(requestParameters: PostProjectLockRightsUpdateRequest, initOverrides?: RequestInit): Promise<void> { await this.postProjectLockRightsUpdateRaw(requestParameters, initOverrides); } }