cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
248 lines (203 loc) • 8.7 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* CWMS Data API
* CWMS REST API for Data Retrieval
*
* The version of the OpenAPI document: 2.3.2-2025.03.19
*
*
* 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 type {
CdaError,
LockRevokerRights,
} from '../models/index';
import {
CdaErrorFromJSON,
CdaErrorToJSON,
LockRevokerRightsFromJSON,
LockRevokerRightsToJSON,
} from '../models/index';
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 cwmsData projectLockRights
*/
async getProjectLockRightsRaw(requestParameters: GetProjectLockRightsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<LockRevokerRights>>> {
if (requestParameters['officeMask'] == null) {
throw new runtime.RequiredError(
'officeMask',
'Required parameter "officeMask" was null or undefined when calling getProjectLockRights().'
);
}
const queryParameters: any = {};
if (requestParameters['officeMask'] != null) {
queryParameters['office-mask'] = requestParameters['officeMask'];
}
if (requestParameters['projectMask'] != null) {
queryParameters['project-mask'] = requestParameters['projectMask'];
}
if (requestParameters['applicationMask'] != null) {
queryParameters['application-mask'] = requestParameters['applicationMask'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = await 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 cwmsData projectLockRights
*/
async getProjectLockRights(requestParameters: GetProjectLockRightsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): 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 cwmsData projectLockRights removeAll
*/
async postProjectLockRightsRemoveAllRaw(requestParameters: PostProjectLockRightsRemoveAllRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError(
'office',
'Required parameter "office" was null or undefined when calling postProjectLockRightsRemoveAll().'
);
}
if (requestParameters['applicationId'] == null) {
throw new runtime.RequiredError(
'applicationId',
'Required parameter "applicationId" was null or undefined when calling postProjectLockRightsRemoveAll().'
);
}
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError(
'userId',
'Required parameter "userId" was null or undefined when calling postProjectLockRightsRemoveAll().'
);
}
const queryParameters: any = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['applicationId'] != null) {
queryParameters['application-id'] = requestParameters['applicationId'];
}
if (requestParameters['userId'] != null) {
queryParameters['user-id'] = requestParameters['userId'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = await 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 cwmsData projectLockRights removeAll
*/
async postProjectLockRightsRemoveAll(requestParameters: PostProjectLockRightsRemoveAllRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.postProjectLockRightsRemoveAllRaw(requestParameters, initOverrides);
}
/**
* Update Lock Revoker Rights.
* Post cwmsData projectLockRights update
*/
async postProjectLockRightsUpdateRaw(requestParameters: PostProjectLockRightsUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError(
'office',
'Required parameter "office" was null or undefined when calling postProjectLockRightsUpdate().'
);
}
if (requestParameters['applicationId'] == null) {
throw new runtime.RequiredError(
'applicationId',
'Required parameter "applicationId" was null or undefined when calling postProjectLockRightsUpdate().'
);
}
if (requestParameters['userId'] == null) {
throw new runtime.RequiredError(
'userId',
'Required parameter "userId" was null or undefined when calling postProjectLockRightsUpdate().'
);
}
if (requestParameters['allow'] == null) {
throw new runtime.RequiredError(
'allow',
'Required parameter "allow" was null or undefined when calling postProjectLockRightsUpdate().'
);
}
const queryParameters: any = {};
if (requestParameters['office'] != null) {
queryParameters['office'] = requestParameters['office'];
}
if (requestParameters['projectMask'] != null) {
queryParameters['project-mask'] = requestParameters['projectMask'];
}
if (requestParameters['applicationId'] != null) {
queryParameters['application-id'] = requestParameters['applicationId'];
}
if (requestParameters['userId'] != null) {
queryParameters['user-id'] = requestParameters['userId'];
}
if (requestParameters['allow'] != null) {
queryParameters['allow'] = requestParameters['allow'];
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = await 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 cwmsData projectLockRights update
*/
async postProjectLockRightsUpdate(requestParameters: PostProjectLockRightsUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
await this.postProjectLockRightsUpdateRaw(requestParameters, initOverrides);
}
}