UNPKG

cwmsjs

Version:

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

236 lines (190 loc) 9.12 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, DeleteMethod, DeleteMethodFromJSON, DeleteMethodToJSON, StandardTextCatalog, StandardTextCatalogFromJSON, StandardTextCatalogToJSON, StandardTextValue, StandardTextValueFromJSON, StandardTextValueToJSON, } from '../models'; 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 standardTextId with standardTextId */ async deleteStandardTextIdWithStandardTextIdRaw(requestParameters: DeleteStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.standardTextId === null || requestParameters.standardTextId === undefined) { throw new runtime.RequiredError('standardTextId','Required parameter requestParameters.standardTextId was null or undefined when calling deleteStandardTextIdWithStandardTextId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling deleteStandardTextIdWithStandardTextId.'); } if (requestParameters.method === null || requestParameters.method === undefined) { throw new runtime.RequiredError('method','Required parameter requestParameters.method was null or undefined when calling deleteStandardTextIdWithStandardTextId.'); } const queryParameters: any = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.method !== undefined) { queryParameters['method'] = requestParameters.method; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = 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 standardTextId with standardTextId */ async deleteStandardTextIdWithStandardTextId(requestParameters: DeleteStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit): Promise<void> { await this.deleteStandardTextIdWithStandardTextIdRaw(requestParameters, initOverrides); } /** * Retrieve a Standard Text catalog * Get standardTextId */ async getStandardTextIdRaw(requestParameters: GetStandardTextIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<StandardTextCatalog>> { const queryParameters: any = {}; if (requestParameters.officeMask !== undefined) { queryParameters['office-mask'] = requestParameters.officeMask; } if (requestParameters.standardTextIdMask !== undefined) { queryParameters['standard-text-id-mask'] = requestParameters.standardTextIdMask; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = 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 standardTextId */ async getStandardTextId(requestParameters: GetStandardTextIdRequest = {}, initOverrides?: RequestInit): Promise<StandardTextCatalog> { const response = await this.getStandardTextIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve a single Standard Text value * Get standardTextId with standardTextId */ async getStandardTextIdWithStandardTextIdRaw(requestParameters: GetStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<StandardTextValue>> { if (requestParameters.standardTextId === null || requestParameters.standardTextId === undefined) { throw new runtime.RequiredError('standardTextId','Required parameter requestParameters.standardTextId was null or undefined when calling getStandardTextIdWithStandardTextId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling getStandardTextIdWithStandardTextId.'); } const queryParameters: any = {}; 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: `/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 standardTextId with standardTextId */ async getStandardTextIdWithStandardTextId(requestParameters: GetStandardTextIdWithStandardTextIdRequest, initOverrides?: RequestInit): Promise<StandardTextValue> { const response = await this.getStandardTextIdWithStandardTextIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Create new Standard Text * Post standardTextId */ async postStandardTextIdRaw(requestParameters: PostStandardTextIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.standardTextValue === null || requestParameters.standardTextValue === undefined) { throw new runtime.RequiredError('standardTextValue','Required parameter requestParameters.standardTextValue was null or undefined when calling postStandardTextId.'); } 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: `/standard-text-id`, method: 'POST', headers: headerParameters, query: queryParameters, body: StandardTextValueToJSON(requestParameters.standardTextValue), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Create new Standard Text * Post standardTextId */ async postStandardTextId(requestParameters: PostStandardTextIdRequest, initOverrides?: RequestInit): Promise<void> { await this.postStandardTextIdRaw(requestParameters, initOverrides); } }