UNPKG

cwmsjs

Version:

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

150 lines (149 loc) 10.6 kB
"use strict"; /* 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. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const runtime = require("../runtime"); const models_1 = require("../models"); /** * */ class PumpAccountingApi extends runtime.BaseAPI { /** * Get pump accounting entries associated with a water supply contract. * Get projects with office with projectId waterUser with waterUser contracts with contractName accounting */ getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccountingRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.projectId === null || requestParameters.projectId === undefined) { throw new runtime.RequiredError('projectId', 'Required parameter requestParameters.projectId was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.waterUser === null || requestParameters.waterUser === undefined) { throw new runtime.RequiredError('waterUser', 'Required parameter requestParameters.waterUser was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.contractName === null || requestParameters.contractName === undefined) { throw new runtime.RequiredError('contractName', 'Required parameter requestParameters.contractName was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.start === null || requestParameters.start === undefined) { throw new runtime.RequiredError('start', 'Required parameter requestParameters.start was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.end === null || requestParameters.end === undefined) { throw new runtime.RequiredError('end', 'Required parameter requestParameters.end was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } const queryParameters = {}; if (requestParameters.start !== undefined) { queryParameters['start'] = requestParameters.start; } if (requestParameters.end !== undefined) { queryParameters['end'] = requestParameters.end; } if (requestParameters.timezone !== undefined) { queryParameters['timezone'] = requestParameters.timezone; } if (requestParameters.unit !== undefined) { queryParameters['unit'] = requestParameters.unit; } if (requestParameters.startTimeInclusive !== undefined) { queryParameters['start-time-inclusive'] = requestParameters.startTimeInclusive; } if (requestParameters.endTimeInclusive !== undefined) { queryParameters['end-time-inclusive'] = requestParameters.endTimeInclusive; } if (requestParameters.ascending !== undefined) { queryParameters['ascending'] = requestParameters.ascending; } if (requestParameters.rowLimit !== undefined) { queryParameters['row-limit'] = requestParameters.rowLimit; } const headerParameters = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}/accounting`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters.office))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters.projectId))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters.waterUser))).replace(`{${"contract-name"}}`, encodeURIComponent(String(requestParameters.contractName))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.WaterSupplyAccountingFromJSON)); }); } /** * Get pump accounting entries associated with a water supply contract. * Get projects with office with projectId waterUser with waterUser contracts with contractName accounting */ getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { const response = yield this.getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccountingRaw(requestParameters, initOverrides); return yield response.value(); }); } /** * Create a new pump accounting entry associated with a water supply contract. * Post projects with office with projectId waterUser with waterUser contracts with contractName accounting */ postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccountingRaw(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { if (requestParameters.office === null || requestParameters.office === undefined) { throw new runtime.RequiredError('office', 'Required parameter requestParameters.office was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.projectId === null || requestParameters.projectId === undefined) { throw new runtime.RequiredError('projectId', 'Required parameter requestParameters.projectId was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.waterUser === null || requestParameters.waterUser === undefined) { throw new runtime.RequiredError('waterUser', 'Required parameter requestParameters.waterUser was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.contractName === null || requestParameters.contractName === undefined) { throw new runtime.RequiredError('contractName', 'Required parameter requestParameters.contractName was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } if (requestParameters.waterSupplyAccounting === null || requestParameters.waterSupplyAccounting === undefined) { throw new runtime.RequiredError('waterSupplyAccounting', 'Required parameter requestParameters.waterSupplyAccounting was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting.'); } const queryParameters = {}; const headerParameters = {}; headerParameters['Content-Type'] = 'application/json;version=1'; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = yield this.request({ path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}/accounting`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters.office))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters.projectId))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters.waterUser))).replace(`{${"contract-name"}}`, encodeURIComponent(String(requestParameters.contractName))), method: 'POST', headers: headerParameters, query: queryParameters, body: models_1.WaterSupplyAccountingToJSON(requestParameters.waterSupplyAccounting), }, initOverrides); return new runtime.VoidApiResponse(response); }); } /** * Create a new pump accounting entry associated with a water supply contract. * Post projects with office with projectId waterUser with waterUser contracts with contractName accounting */ postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccounting(requestParameters, initOverrides) { return __awaiter(this, void 0, void 0, function* () { yield this.postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameAccountingRaw(requestParameters, initOverrides); }); } } exports.PumpAccountingApi = PumpAccountingApi;