cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
629 lines (628 loc) • 40.5 kB
JavaScript
"use strict";
/* 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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.WaterContractsApi = void 0;
const runtime = require("../runtime");
const index_1 = require("../models/index");
/**
*
*/
class WaterContractsApi extends runtime.BaseAPI {
/**
* Delete a water contract type
* Delete cwmsData projects with office contractTypes with displayValue
*/
deleteProjectsWithOfficeContractTypesWithDisplayValueRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteProjectsWithOfficeContractTypesWithDisplayValue().');
}
if (requestParameters['displayValue'] == null) {
throw new runtime.RequiredError('displayValue', 'Required parameter "displayValue" was null or undefined when calling deleteProjectsWithOfficeContractTypesWithDisplayValue().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/contract-types/{display-value}`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"display-value"}}`, encodeURIComponent(String(requestParameters['displayValue']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Delete a water contract type
* Delete cwmsData projects with office contractTypes with displayValue
*/
deleteProjectsWithOfficeContractTypesWithDisplayValue(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteProjectsWithOfficeContractTypesWithDisplayValueRaw(requestParameters, initOverrides);
});
}
/**
* Deletes a water user from CWMS.
* Delete cwmsData projects with office with projectId waterUser with waterUser
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
const queryParameters = {};
if (requestParameters['method'] != null) {
queryParameters['method'] = requestParameters['method'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters['waterUser']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Deletes a water user from CWMS.
* Delete cwmsData projects with office with projectId waterUser with waterUser
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUser(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides);
});
}
/**
* Delete a specified water contract
* Delete cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['contractName'] == null) {
throw new runtime.RequiredError('contractName', 'Required parameter "contractName" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
const queryParameters = {};
if (requestParameters['method'] != null) {
queryParameters['method'] = requestParameters['method'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}`.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: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Delete a specified water contract
* Delete cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides);
});
}
/**
* Disassociate a pump from a contract
* Delete cwmsData projects with office with projectId waterUser with waterUser contracts with contractName pumps with name
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
if (requestParameters['contractName'] == null) {
throw new runtime.RequiredError('contractName', 'Required parameter "contractName" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
if (requestParameters['name'] == null) {
throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
if (requestParameters['pumpType'] == null) {
throw new runtime.RequiredError('pumpType', 'Required parameter "pumpType" was null or undefined when calling deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName().');
}
const queryParameters = {};
if (requestParameters['pumpType'] != null) {
queryParameters['pump-type'] = requestParameters['pumpType'];
}
if (requestParameters['deleteAccounting'] != null) {
queryParameters['delete-accounting'] = requestParameters['deleteAccounting'];
}
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}/pumps/{name}`.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']))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters['name']))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Disassociate a pump from a contract
* Delete cwmsData projects with office with projectId waterUser with waterUser contracts with contractName pumps with name
*/
deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.deleteProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNamePumpsWithNameRaw(requestParameters, initOverrides);
});
}
/**
* Get all water contract types
* Get cwmsData projects with office contractTypes
*/
getProjectsWithOfficeContractTypesRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getProjectsWithOfficeContractTypes().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/contract-types`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.LookupTypeFromJSON)(jsonValue));
});
}
/**
* Get all water contract types
* Get cwmsData projects with office contractTypes
*/
getProjectsWithOfficeContractTypes(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getProjectsWithOfficeContractTypesRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Gets all water users.
* Get cwmsData projects with office with projectId waterUser
*/
getProjectsWithOfficeWithProjectIdWaterUserRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUser().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUser().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WaterUserFromJSON)(jsonValue));
});
}
/**
* Gets all water users.
* Get cwmsData projects with office with projectId waterUser
*/
getProjectsWithOfficeWithProjectIdWaterUser(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getProjectsWithOfficeWithProjectIdWaterUserRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Gets a specified water user.
* Get cwmsData projects with office with projectId waterUser with waterUser
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters['waterUser']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WaterUserContractFromJSON)(jsonValue));
});
}
/**
* Gets a specified water user.
* Get cwmsData projects with office with projectId waterUser with waterUser
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUser(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Return all water contracts
* Get cwmsData projects with office with projectId waterUser with waterUser contracts
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters['waterUser']))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.WaterUserContractFromJSON)(jsonValue));
});
}
/**
* Return all water contracts
* Get cwmsData projects with office with projectId waterUser with waterUser contracts
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Return a specified water contract
* Get cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['contractName'] == null) {
throw new runtime.RequiredError('contractName', 'Required parameter "contractName" was null or undefined when calling getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
const queryParameters = {};
const headerParameters = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}`.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) => (0, index_1.WaterUserContractFromJSON)(jsonValue));
});
}
/**
* Return a specified water contract
* Get cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.getProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Updates a water user in CWMS.
* Patch cwmsData projects with office with projectId waterUser with waterUser
*/
patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['name'] == null) {
throw new runtime.RequiredError('name', 'Required parameter "name" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
if (requestParameters['waterUser2'] == null) {
throw new runtime.RequiredError('waterUser2', 'Required parameter "waterUser2" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser().');
}
const queryParameters = {};
if (requestParameters['name'] != null) {
queryParameters['name'] = requestParameters['name'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=1';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters['waterUser']))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.WaterUserToJSON)(requestParameters['waterUser2']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Updates a water user in CWMS.
* Patch cwmsData projects with office with projectId waterUser with waterUser
*/
patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUser(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserRaw(requestParameters, initOverrides);
});
}
/**
* Renames a water contract
* Patch cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['contractName'] == null) {
throw new runtime.RequiredError('contractName', 'Required parameter "contractName" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['contractName2'] == null) {
throw new runtime.RequiredError('contractName2', 'Required parameter "contractName2" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
if (requestParameters['waterUserContract'] == null) {
throw new runtime.RequiredError('waterUserContract', 'Required parameter "waterUserContract" was null or undefined when calling patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName().');
}
const queryParameters = {};
if (requestParameters['contractName2'] != null) {
queryParameters['contract-name'] = requestParameters['contractName2'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=1';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts/{contract-name}`.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: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.WaterUserContractToJSON)(requestParameters['waterUserContract']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Renames a water contract
* Patch cwmsData projects with office with projectId waterUser with waterUser contracts with contractName
*/
patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractName(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.patchProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsWithContractNameRaw(requestParameters, initOverrides);
});
}
/**
* Create a new water contract type
* Post cwmsData projects with office contractTypes
*/
postProjectsWithOfficeContractTypesRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling postProjectsWithOfficeContractTypes().');
}
if (requestParameters['lookupType'] == null) {
throw new runtime.RequiredError('lookupType', 'Required parameter "lookupType" was null or undefined when calling postProjectsWithOfficeContractTypes().');
}
const queryParameters = {};
if (requestParameters['failIfExists'] != null) {
queryParameters['fail-if-exists'] = requestParameters['failIfExists'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=1';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/contract-types`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.LookupTypeToJSON)(requestParameters['lookupType']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create a new water contract type
* Post cwmsData projects with office contractTypes
*/
postProjectsWithOfficeContractTypes(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postProjectsWithOfficeContractTypesRaw(requestParameters, initOverrides);
});
}
/**
* Stores a water user to CWMS.
* Post cwmsData projects with office with projectId waterUser
*/
postProjectsWithOfficeWithProjectIdWaterUserRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUser().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUser().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUser().');
}
const queryParameters = {};
if (requestParameters['failIfExists'] != null) {
queryParameters['fail-if-exists'] = requestParameters['failIfExists'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=1';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.WaterUserToJSON)(requestParameters['waterUser']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Stores a water user to CWMS.
* Post cwmsData projects with office with projectId waterUser
*/
postProjectsWithOfficeWithProjectIdWaterUser(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postProjectsWithOfficeWithProjectIdWaterUserRaw(requestParameters, initOverrides);
});
}
/**
* Create a new water contract
* Post cwmsData projects with office with projectId waterUser with waterUser contracts
*/
postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['office'] == null) {
throw new runtime.RequiredError('office', 'Required parameter "office" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
if (requestParameters['projectId'] == null) {
throw new runtime.RequiredError('projectId', 'Required parameter "projectId" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
if (requestParameters['waterUser'] == null) {
throw new runtime.RequiredError('waterUser', 'Required parameter "waterUser" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
if (requestParameters['waterUserContract'] == null) {
throw new runtime.RequiredError('waterUserContract', 'Required parameter "waterUserContract" was null or undefined when calling postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts().');
}
const queryParameters = {};
if (requestParameters['failIfExists'] != null) {
queryParameters['fail-if-exists'] = requestParameters['failIfExists'];
}
if (requestParameters['ignoreNulls'] != null) {
queryParameters['ignore-nulls'] = requestParameters['ignoreNulls'];
}
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json;version=1';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = yield this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = yield this.request({
path: `/projects/{office}/{project-id}/water-user/{water-user}/contracts`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters['office']))).replace(`{${"project-id"}}`, encodeURIComponent(String(requestParameters['projectId']))).replace(`{${"water-user"}}`, encodeURIComponent(String(requestParameters['waterUser']))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.WaterUserContractToJSON)(requestParameters['waterUserContract']),
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
* Create a new water contract
* Post cwmsData projects with office with projectId waterUser with waterUser contracts
*/
postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContracts(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.postProjectsWithOfficeWithProjectIdWaterUserWithWaterUserContractsRaw(requestParameters, initOverrides);
});
}
}
exports.WaterContractsApi = WaterContractsApi;