UNPKG

cwmsjs

Version:

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

216 lines (173 loc) 8.25 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, LocationCategory, LocationCategoryFromJSON, LocationCategoryToJSON, } from '../models'; export interface DeleteLocationCategoryWithCategoryIdRequest { categoryId: string; office: string; cascadeDelete?: boolean; } export interface GetLocationCategoryRequest { office?: string; } export interface GetLocationCategoryWithCategoryIdRequest { categoryId: string; office: string; } export interface PostLocationCategoryRequest { locationCategory: LocationCategory; } /** * */ export class LocationCategoriesApi extends runtime.BaseAPI { /** * Deletes requested location category * Delete location category with categoryId */ async deleteLocationCategoryWithCategoryIdRaw(requestParameters: DeleteLocationCategoryWithCategoryIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId','Required parameter requestParameters.categoryId was null or undefined when calling deleteLocationCategoryWithCategoryId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling deleteLocationCategoryWithCategoryId.'); } const queryParameters: any = {}; if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.cascadeDelete !== undefined) { queryParameters['cascade-delete'] = requestParameters.cascadeDelete; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/location/category/{category-id}`.replace(`{${"category-id"}}`, encodeURIComponent(String(requestParameters.categoryId))), method: 'DELETE', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Deletes requested location category * Delete location category with categoryId */ async deleteLocationCategoryWithCategoryId(requestParameters: DeleteLocationCategoryWithCategoryIdRequest, initOverrides?: RequestInit): Promise<void> { await this.deleteLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides); } /** * Returns CWMS Location Category Data * Get location category */ async getLocationCategoryRaw(requestParameters: GetLocationCategoryRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Array<LocationCategory>>> { 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: `/location/category`, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(LocationCategoryFromJSON)); } /** * Returns CWMS Location Category Data * Get location category */ async getLocationCategory(requestParameters: GetLocationCategoryRequest = {}, initOverrides?: RequestInit): Promise<Array<LocationCategory>> { const response = await this.getLocationCategoryRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieves requested Location Category * Get location category with categoryId */ async getLocationCategoryWithCategoryIdRaw(requestParameters: GetLocationCategoryWithCategoryIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<LocationCategory>> { if (requestParameters.categoryId === null || requestParameters.categoryId === undefined) { throw new runtime.RequiredError('categoryId','Required parameter requestParameters.categoryId was null or undefined when calling getLocationCategoryWithCategoryId.'); } if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling getLocationCategoryWithCategoryId.'); } 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: `/location/category/{category-id}`.replace(`{${"category-id"}}`, encodeURIComponent(String(requestParameters.categoryId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => LocationCategoryFromJSON(jsonValue)); } /** * Retrieves requested Location Category * Get location category with categoryId */ async getLocationCategoryWithCategoryId(requestParameters: GetLocationCategoryWithCategoryIdRequest, initOverrides?: RequestInit): Promise<LocationCategory> { const response = await this.getLocationCategoryWithCategoryIdRaw(requestParameters, initOverrides); return await response.value(); } /** * Create new LocationCategory * Post location category */ async postLocationCategoryRaw(requestParameters: PostLocationCategoryRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> { if (requestParameters.locationCategory === null || requestParameters.locationCategory === undefined) { throw new runtime.RequiredError('locationCategory','Required parameter requestParameters.locationCategory was null or undefined when calling postLocationCategory.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/location/category`, method: 'POST', headers: headerParameters, query: queryParameters, body: LocationCategoryToJSON(requestParameters.locationCategory), }, initOverrides); return new runtime.VoidApiResponse(response); } /** * Create new LocationCategory * Post location category */ async postLocationCategory(requestParameters: PostLocationCategoryRequest, initOverrides?: RequestInit): Promise<void> { await this.postLocationCategoryRaw(requestParameters, initOverrides); } }