UNPKG

cwmsjs

Version:

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

320 lines (261 loc) 11.1 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, Property, } from '../models/index'; import { CdaErrorFromJSON, CdaErrorToJSON, PropertyFromJSON, PropertyToJSON, } from '../models/index'; export interface DeletePropertiesWithNameRequest { name: string; office: string; categoryId: string; } export interface GetPropertiesRequest { officeMask?: string; categoryId?: string; nameMask?: string; } export interface GetPropertiesWithNameRequest { name: string; office: string; categoryId: string; defaultValue?: string; } export interface PatchPropertiesWithNameRequest { name: string; property: Property; } export interface PostPropertiesRequest { property: Property; } /** * */ export class PropertiesApi extends runtime.BaseAPI { /** * Delete CWMS Property * Delete cwmsData properties with name */ async deletePropertiesWithNameRaw(requestParameters: DeletePropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['name'] == null) { throw new runtime.RequiredError( 'name', 'Required parameter "name" was null or undefined when calling deletePropertiesWithName().' ); } if (requestParameters['office'] == null) { throw new runtime.RequiredError( 'office', 'Required parameter "office" was null or undefined when calling deletePropertiesWithName().' ); } if (requestParameters['categoryId'] == null) { throw new runtime.RequiredError( 'categoryId', 'Required parameter "categoryId" was null or undefined when calling deletePropertiesWithName().' ); } const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } 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: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Delete CWMS Property * Delete cwmsData properties with name */ async deletePropertiesWithName(requestParameters: DeletePropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.deletePropertiesWithNameRaw(requestParameters, initOverrides); } /** * Returns matching CWMS Property Data. * Get cwmsData properties */ async getPropertiesRaw(requestParameters: GetPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Property>>> { const queryParameters: any = {}; if (requestParameters['officeMask'] != null) { queryParameters['office-mask'] = requestParameters['officeMask']; } if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } if (requestParameters['nameMask'] != null) { queryParameters['name-mask'] = requestParameters['nameMask']; } 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: `/properties`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(PropertyFromJSON)); } /** * Returns matching CWMS Property Data. * Get cwmsData properties */ async getProperties(requestParameters: GetPropertiesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Property>> { const response = await this.getPropertiesRaw(requestParameters, initOverrides); return await response.value(); } /** * Returns CWMS Property Data * Get cwmsData properties with name */ async getPropertiesWithNameRaw(requestParameters: GetPropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Property>> { if (requestParameters['name'] == null) { throw new runtime.RequiredError( 'name', 'Required parameter "name" was null or undefined when calling getPropertiesWithName().' ); } if (requestParameters['office'] == null) { throw new runtime.RequiredError( 'office', 'Required parameter "office" was null or undefined when calling getPropertiesWithName().' ); } if (requestParameters['categoryId'] == null) { throw new runtime.RequiredError( 'categoryId', 'Required parameter "categoryId" was null or undefined when calling getPropertiesWithName().' ); } const queryParameters: any = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } if (requestParameters['defaultValue'] != null) { queryParameters['default-value'] = requestParameters['defaultValue']; } 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: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => PropertyFromJSON(jsonValue)); } /** * Returns CWMS Property Data * Get cwmsData properties with name */ async getPropertiesWithName(requestParameters: GetPropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Property> { const response = await this.getPropertiesWithNameRaw(requestParameters, initOverrides); return await response.value(); } /** * Update CWMS Property * Patch cwmsData properties with name */ async patchPropertiesWithNameRaw(requestParameters: PatchPropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['name'] == null) { throw new runtime.RequiredError( 'name', 'Required parameter "name" was null or undefined when calling patchPropertiesWithName().' ); } if (requestParameters['property'] == null) { throw new runtime.RequiredError( 'property', 'Required parameter "property" was null or undefined when calling patchPropertiesWithName().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/properties/{name}`.replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))), method: 'PATCH', headers: headerParameters, query: queryParameters, body: PropertyToJSON(requestParameters['property']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Update CWMS Property * Patch cwmsData properties with name */ async patchPropertiesWithName(requestParameters: PatchPropertiesWithNameRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.patchPropertiesWithNameRaw(requestParameters, initOverrides); } /** * Create CWMS Property * Post cwmsData properties */ async postPropertiesRaw(requestParameters: PostPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> { if (requestParameters['property'] == null) { throw new runtime.RequiredError( 'property', 'Required parameter "property" was null or undefined when calling postProperties().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = await this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/properties`, method: 'POST', headers: headerParameters, query: queryParameters, body: PropertyToJSON(requestParameters['property']), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Create CWMS Property * Post cwmsData properties */ async postProperties(requestParameters: PostPropertiesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> { await this.postPropertiesRaw(requestParameters, initOverrides); } }