UNPKG

cwmsjs

Version:

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

256 lines (210 loc) 9.44 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, DeleteMethod, StandardTextCatalog, StandardTextValue, } from '../models/index'; import { CdaErrorFromJSON, CdaErrorToJSON, DeleteMethodFromJSON, DeleteMethodToJSON, StandardTextCatalogFromJSON, StandardTextCatalogToJSON, StandardTextValueFromJSON, StandardTextValueToJSON, } from '../models/index'; export interface DeleteStandardTextIdWithStandardTextIdRequest { standardTextId: string; office: string; method: DeleteMethod; } export interface GetStandardTextIdRequest { officeMask?: string; standardTextIdMask?: string; } export interface GetStandardTextIdWithStandardTextIdRequest { standardTextId: string; office: string; } export interface PostStandardTextIdRequest { standardTextValue: StandardTextValue; failIfExists?: boolean; } /** * */ export class StandardTextApi extends runtime.BaseAPI { /** * Delete a single Standard Text value * Delete cwmsData standardTextId with standardTextId */ async deleteStandardTextIdWithStandardTextIdRaw(requestParameters: DeleteStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['standardTextId'] == null) { throw new runtime.RequiredError( 'standardTextId', 'Required parameter "standardTextId" was null or undefined when calling deleteStandardTextIdWithStandardTextId().' ); } if (requestParameters['office'] == null) { throw new runtime.RequiredError( 'office', 'Required parameter "office" was null or undefined when calling deleteStandardTextIdWithStandardTextId().' ); } if (requestParameters['method'] == null) { throw new runtime.RequiredError( 'method', 'Required parameter "method" was null or undefined when calling deleteStandardTextIdWithStandardTextId().' ); } const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['method'] != null) { queryParameters['method'] = requestParameters['method']; } 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: `/standard-text-id/{standard-text-id}`.replace(`{${"standard-text-id"}}`, encodeURIComponent(String(requestParameters['standardTextId']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Delete a single Standard Text value * Delete cwmsData standardTextId with standardTextId */ async deleteStandardTextIdWithStandardTextId(requestParameters: DeleteStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.deleteStandardTextIdWithStandardTextIdRaw(requestParameters, initOverrides); } /** * Retrieve a Standard Text catalog * Get cwmsData standardTextId */ async getStandardTextIdRaw(requestParameters: GetStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StandardTextCatalog>> { const queryParameters: any = {}; if (requestParameters['officeMask'] != null) { queryParameters['office-mask'] = requestParameters['officeMask']; } if (requestParameters['standardTextIdMask'] != null) { queryParameters['standard-text-id-mask'] = requestParameters['standardTextIdMask']; } 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: `/standard-text-id`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StandardTextCatalogFromJSON(jsonValue)); } /** * Retrieve a Standard Text catalog * Get cwmsData standardTextId */ async getStandardTextId(requestParameters: GetStandardTextIdRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StandardTextCatalog> { const response = await this.getStandardTextIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a single Standard Text value * Get cwmsData standardTextId with standardTextId */ async getStandardTextIdWithStandardTextIdRaw(requestParameters: GetStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StandardTextValue>> { if (requestParameters['standardTextId'] == null) { throw new runtime.RequiredError( 'standardTextId', 'Required parameter "standardTextId" was null or undefined when calling getStandardTextIdWithStandardTextId().' ); } if (requestParameters['office'] == null) { throw new runtime.RequiredError( 'office', 'Required parameter "office" was null or undefined when calling getStandardTextIdWithStandardTextId().' ); } 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: `/standard-text-id/{standard-text-id}`.replace(`{${"standard-text-id"}}`, encodeURIComponent(String(requestParameters['standardTextId']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => StandardTextValueFromJSON(jsonValue)); } /** * Retrieve a single Standard Text value * Get cwmsData standardTextId with standardTextId */ async getStandardTextIdWithStandardTextId(requestParameters: GetStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StandardTextValue> { const response = await this.getStandardTextIdWithStandardTextIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Create new Standard Text * Post cwmsData standardTextId */ async postStandardTextIdRaw(requestParameters: PostStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['standardTextValue'] == null) { throw new runtime.RequiredError( 'standardTextValue', 'Required parameter "standardTextValue" was null or undefined when calling postStandardTextId().' ); } 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: `/standard-text-id`, method: 'POST', headers: headerParameters, query: queryParameters, body: StandardTextValueToJSON(requestParameters['standardTextValue']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Create new Standard Text * Post cwmsData standardTextId */ async postStandardTextId(requestParameters: PostStandardTextIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.postStandardTextIdRaw(requestParameters, initOverrides); } }