cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
308 lines (246 loc) • 11.5 kB
text/typescript
/* 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,
Clob,
ClobFromJSON,
ClobToJSON,
Clobs,
ClobsFromJSON,
ClobsToJSON,
} from '../models';
export interface DeleteClobsWithClobIdRequest {
clobId: string;
clobId2: string;
office: string;
}
export interface GetClobsRequest {
office?: string;
page?: string;
pageSize?: number;
includeValues?: boolean;
like?: string;
}
export interface GetClobsWithClobIdRequest {
clobId: string;
office?: string;
clobId2?: string;
}
export interface PatchClobsWithClobIdRequest {
clobId: string;
clobId2: string;
clob: Clob;
ignoreNulls?: boolean;
}
export interface PostClobsRequest {
clob: Clob;
failIfExists?: boolean;
}
/**
*
*/
export class ClobApi extends runtime.BaseAPI {
/**
* Delete clob
* Delete clobs with clobId
*/
async deleteClobsWithClobIdRaw(requestParameters: DeleteClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId','Required parameter requestParameters.clobId was null or undefined when calling deleteClobsWithClobId.');
}
if (requestParameters.clobId2 === null || requestParameters.clobId2 === undefined) {
throw new runtime.RequiredError('clobId2','Required parameter requestParameters.clobId2 was null or undefined when calling deleteClobsWithClobId.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling deleteClobsWithClobId.');
}
const queryParameters: any = {};
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Delete clob
* Delete clobs with clobId
*/
async deleteClobsWithClobId(requestParameters: DeleteClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<void> {
await this.deleteClobsWithClobIdRaw(requestParameters, initOverrides);
}
/**
* Get clobs
*/
async getClobsRaw(requestParameters: GetClobsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Clobs>> {
const queryParameters: any = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.page !== undefined) {
queryParameters['page'] = requestParameters.page;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['page-size'] = requestParameters.pageSize;
}
if (requestParameters.includeValues !== undefined) {
queryParameters['include-values'] = requestParameters.includeValues;
}
if (requestParameters.like !== undefined) {
queryParameters['like'] = requestParameters.like;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/clobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ClobsFromJSON(jsonValue));
}
/**
* Get clobs
*/
async getClobs(requestParameters: GetClobsRequest = {}, initOverrides?: RequestInit): Promise<Clobs> {
const response = await this.getClobsRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get a single clob. If the accept header is set to text/plain, the raw value is returned as the response body. Responses to text/plain requests are streamed and support the Range header. When the accept header is set to application/json;version=2 the clob will be returned as a serialized Clob object with fields for office-id, id, description and value. For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a>
* Get clobs with clobId
*/
async getClobsWithClobIdRaw(requestParameters: GetClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Clob>> {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId','Required parameter requestParameters.clobId was null or undefined when calling getClobsWithClobId.');
}
const queryParameters: any = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => ClobFromJSON(jsonValue));
}
/**
* Get a single clob. If the accept header is set to text/plain, the raw value is returned as the response body. Responses to text/plain requests are streamed and support the Range header. When the accept header is set to application/json;version=2 the clob will be returned as a serialized Clob object with fields for office-id, id, description and value. For more information about accept header usage, <a href=\"legacy-format/\">see this page.</a>
* Get clobs with clobId
*/
async getClobsWithClobId(requestParameters: GetClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<Clob> {
const response = await this.getClobsWithClobIdRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update clob
* Patch clobs with clobId
*/
async patchClobsWithClobIdRaw(requestParameters: PatchClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.clobId === null || requestParameters.clobId === undefined) {
throw new runtime.RequiredError('clobId','Required parameter requestParameters.clobId was null or undefined when calling patchClobsWithClobId.');
}
if (requestParameters.clobId2 === null || requestParameters.clobId2 === undefined) {
throw new runtime.RequiredError('clobId2','Required parameter requestParameters.clobId2 was null or undefined when calling patchClobsWithClobId.');
}
if (requestParameters.clob === null || requestParameters.clob === undefined) {
throw new runtime.RequiredError('clob','Required parameter requestParameters.clob was null or undefined when calling patchClobsWithClobId.');
}
const queryParameters: any = {};
if (requestParameters.clobId2 !== undefined) {
queryParameters['clob-id'] = requestParameters.clobId2;
}
if (requestParameters.ignoreNulls !== undefined) {
queryParameters['ignore-nulls'] = requestParameters.ignoreNulls;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/clobs/{clob-id}`.replace(`{${"clob-id"}}`, encodeURIComponent(String(requestParameters.clobId))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: ClobToJSON(requestParameters.clob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Update clob
* Patch clobs with clobId
*/
async patchClobsWithClobId(requestParameters: PatchClobsWithClobIdRequest, initOverrides?: RequestInit): Promise<void> {
await this.patchClobsWithClobIdRaw(requestParameters, initOverrides);
}
/**
* Create new Clob
* Post clobs
*/
async postClobsRaw(requestParameters: PostClobsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.clob === null || requestParameters.clob === undefined) {
throw new runtime.RequiredError('clob','Required parameter requestParameters.clob was null or undefined when calling postClobs.');
}
const queryParameters: any = {};
if (requestParameters.failIfExists !== undefined) {
queryParameters['fail-if-exists'] = requestParameters.failIfExists;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/clobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: ClobToJSON(requestParameters.clob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Create new Clob
* Post clobs
*/
async postClobs(requestParameters: PostClobsRequest, initOverrides?: RequestInit): Promise<void> {
await this.postClobsRaw(requestParameters, initOverrides);
}
}