UNPKG

cwmsjs

Version:

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

310 lines (252 loc) 11 kB
/* 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, Clob, Clobs, } from '../models/index'; import { CdaErrorFromJSON, CdaErrorToJSON, ClobFromJSON, ClobToJSON, ClobsFromJSON, ClobsToJSON, } from '../models/index'; export interface DeleteClobsWithClobIdRequest { clobId: 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; clob: Clob; ignoreNulls?: boolean; } export interface PostClobsRequest { clob: Clob; failIfExists?: boolean; } /** * */ export class ClobApi extends runtime.BaseAPI { /** * Delete clob * Delete cwmsData clobs with clobId */ async deleteClobsWithClobIdRaw(requestParameters: DeleteClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['clobId'] == null) { throw new runtime.RequiredError( 'clobId', 'Required parameter "clobId" was null or undefined when calling deleteClobsWithClobId().' ); } if (requestParameters['office'] == null) { throw new runtime.RequiredError( 'office', 'Required parameter "office" was null or undefined when calling deleteClobsWithClobId().' ); } const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } 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: `/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 cwmsData clobs with clobId */ async deleteClobsWithClobId(requestParameters: DeleteClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.deleteClobsWithClobIdRaw(requestParameters, initOverrides); } /** * Get cwmsData clobs */ async getClobsRaw(requestParameters: GetClobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Clobs>> { const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['page'] != null) { queryParameters['page'] = requestParameters['page']; } if (requestParameters['pageSize'] != null) { queryParameters['page-size'] = requestParameters['pageSize']; } if (requestParameters['includeValues'] != null) { queryParameters['include-values'] = requestParameters['includeValues']; } if (requestParameters['like'] != null) { queryParameters['like'] = requestParameters['like']; } 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: `/clobs`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => ClobsFromJSON(jsonValue)); } /** * Get cwmsData clobs */ async getClobs(requestParameters: GetClobsRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): 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. * Get cwmsData clobs with clobId */ async getClobsWithClobIdRaw(requestParameters: GetClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Clob>> { if (requestParameters['clobId'] == null) { throw new runtime.RequiredError( 'clobId', 'Required parameter "clobId" was null or undefined when calling getClobsWithClobId().' ); } const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['clobId2'] != null) { queryParameters['clob-id'] = requestParameters['clobId2']; } 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: `/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. * Get cwmsData clobs with clobId */ async getClobsWithClobId(requestParameters: GetClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Clob> { const response = await this.getClobsWithClobIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Update clob * Patch cwmsData clobs with clobId */ async patchClobsWithClobIdRaw(requestParameters: PatchClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['clobId'] == null) { throw new runtime.RequiredError( 'clobId', 'Required parameter "clobId" was null or undefined when calling patchClobsWithClobId().' ); } if (requestParameters['clob'] == null) { throw new runtime.RequiredError( 'clob', 'Required parameter "clob" was null or undefined when calling patchClobsWithClobId().' ); } const queryParameters: any = {}; if (requestParameters['ignoreNulls'] != null) { queryParameters['ignore-nulls'] = requestParameters['ignoreNulls']; } const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json;version=2'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await 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 cwmsData clobs with clobId */ async patchClobsWithClobId(requestParameters: PatchClobsWithClobIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.patchClobsWithClobIdRaw(requestParameters, initOverrides); } /** * Create new Clob * Post cwmsData clobs */ async postClobsRaw(requestParameters: PostClobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['clob'] == null) { throw new runtime.RequiredError( 'clob', 'Required parameter "clob" was null or undefined when calling postClobs().' ); } const queryParameters: any = {}; if (requestParameters['failIfExists'] != null) { 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"] = await 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 cwmsData clobs */ async postClobs(requestParameters: PostClobsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.postClobsRaw(requestParameters, initOverrides); } }