UNPKG

cwmsjs

Version:

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

232 lines (231 loc) 10.7 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. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import * as runtime from '../runtime'; import { PropertyFromJSON, PropertyToJSON, } from '../models/index'; /** * */ export class PropertiesApi extends runtime.BaseAPI { /** * Delete CWMS Property * Delete cwmsData properties with name */ deletePropertiesWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { 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 = {}; if (requestParameters['office'] != null) { queryParameters['office'] = requestParameters['office']; } if (requestParameters['categoryId'] != null) { queryParameters['category-id'] = requestParameters['categoryId']; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield 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 */ deletePropertiesWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.deletePropertiesWithNameRaw(requestParameters, initOverrides); }); } /** * Returns matching CWMS Property Data. * Get cwmsData properties */ getPropertiesRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const queryParameters = {}; 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 = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield 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 */ getProperties(requestParameters = {}, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getPropertiesRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Returns CWMS Property Data * Get cwmsData properties with name */ getPropertiesWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { 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 = {}; 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 = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield 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 */ getPropertiesWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getPropertiesWithNameRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Update CWMS Property * Patch cwmsData properties with name */ patchPropertiesWithNameRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { 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 = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield 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 */ patchPropertiesWithName(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.patchPropertiesWithNameRaw(requestParameters, initOverrides); }); } /** * Create CWMS Property * Post cwmsData properties */ postPropertiesRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters['property'] == null) { throw new runtime.RequiredError('property', 'Required parameter "property" was null or undefined when calling postProperties().'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield 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 */ postProperties(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postPropertiesRaw(requestParameters, initOverrides); }); } }