cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
298 lines (238 loc) • 10.5 kB
text/typescript
/* 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 {
Blob,
BlobFromJSON,
BlobToJSON,
Blobs,
BlobsFromJSON,
BlobsToJSON,
CdaError,
CdaErrorFromJSON,
CdaErrorToJSON,
} from '../models';
export interface DeleteBlobsWithBlobIdRequest {
blobId: string;
blobId2: string;
office: string;
}
export interface GetBlobsRequest {
office?: string;
page?: string;
pageSize?: number;
like?: string;
}
export interface GetBlobsWithBlobIdRequest {
blobId: string;
office?: string;
blobId2?: string;
}
export interface PatchBlobsWithBlobIdRequest {
blobId: string;
blobId2: string;
blob: Blob;
}
export interface PostBlobsRequest {
blob: Blob;
failIfExists?: boolean;
}
/**
*
*/
export class BlobApi extends runtime.BaseAPI {
/**
* Deletes requested blob
* Delete blobs with blobId
*/
async deleteBlobsWithBlobIdRaw(requestParameters: DeleteBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId','Required parameter requestParameters.blobId was null or undefined when calling deleteBlobsWithBlobId.');
}
if (requestParameters.blobId2 === null || requestParameters.blobId2 === undefined) {
throw new runtime.RequiredError('blobId2','Required parameter requestParameters.blobId2 was null or undefined when calling deleteBlobsWithBlobId.');
}
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling deleteBlobsWithBlobId.');
}
const queryParameters: any = {};
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
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: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Deletes requested blob
* Delete blobs with blobId
*/
async deleteBlobsWithBlobId(requestParameters: DeleteBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<void> {
await this.deleteBlobsWithBlobIdRaw(requestParameters, initOverrides);
}
/**
* Get blobs
*/
async getBlobsRaw(requestParameters: GetBlobsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Blobs>> {
const queryParameters: any = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.page !== undefined) {
queryParameters['page'] = requestParameters.page;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['page-size'] = requestParameters.pageSize;
}
if (requestParameters.like !== undefined) {
queryParameters['like'] = requestParameters.like;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/blobs`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => BlobsFromJSON(jsonValue));
}
/**
* Get blobs
*/
async getBlobs(requestParameters: GetBlobsRequest = {}, initOverrides?: RequestInit): Promise<Blobs> {
const response = await this.getBlobsRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Returns the binary value of the requested blob as a seekable stream with the appropriate media type.
* Get blobs with blobId
*/
async getBlobsWithBlobIdRaw(requestParameters: GetBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<object>> {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId','Required parameter requestParameters.blobId was null or undefined when calling getBlobsWithBlobId.');
}
const queryParameters: any = {};
if (requestParameters.office !== undefined) {
queryParameters['office'] = requestParameters.office;
}
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse<any>(response);
}
/**
* Returns the binary value of the requested blob as a seekable stream with the appropriate media type.
* Get blobs with blobId
*/
async getBlobsWithBlobId(requestParameters: GetBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<object> {
const response = await this.getBlobsWithBlobIdRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Update an existing Blob
* Patch blobs with blobId
*/
async patchBlobsWithBlobIdRaw(requestParameters: PatchBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.blobId === null || requestParameters.blobId === undefined) {
throw new runtime.RequiredError('blobId','Required parameter requestParameters.blobId was null or undefined when calling patchBlobsWithBlobId.');
}
if (requestParameters.blobId2 === null || requestParameters.blobId2 === undefined) {
throw new runtime.RequiredError('blobId2','Required parameter requestParameters.blobId2 was null or undefined when calling patchBlobsWithBlobId.');
}
if (requestParameters.blob === null || requestParameters.blob === undefined) {
throw new runtime.RequiredError('blob','Required parameter requestParameters.blob was null or undefined when calling patchBlobsWithBlobId.');
}
const queryParameters: any = {};
if (requestParameters.blobId2 !== undefined) {
queryParameters['blob-id'] = requestParameters.blobId2;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/blobs/{blob-id}`.replace(`{${"blob-id"}}`, encodeURIComponent(String(requestParameters.blobId))),
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: BlobToJSON(requestParameters.blob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Update an existing Blob
* Patch blobs with blobId
*/
async patchBlobsWithBlobId(requestParameters: PatchBlobsWithBlobIdRequest, initOverrides?: RequestInit): Promise<void> {
await this.patchBlobsWithBlobIdRaw(requestParameters, initOverrides);
}
/**
* Create new Blob
* Post blobs
*/
async postBlobsRaw(requestParameters: PostBlobsRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<void>> {
if (requestParameters.blob === null || requestParameters.blob === undefined) {
throw new runtime.RequiredError('blob','Required parameter requestParameters.blob was null or undefined when calling postBlobs.');
}
const queryParameters: any = {};
if (requestParameters.failIfExists !== undefined) {
queryParameters['fail-if-exists'] = requestParameters.failIfExists;
}
const headerParameters: runtime.HTTPHeaders = {};
headerParameters['Content-Type'] = 'application/json;version=2';
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/blobs`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: BlobToJSON(requestParameters.blob),
}, initOverrides);
return new runtime.VoidApiResponse(response);
}
/**
* Create new Blob
* Post blobs
*/
async postBlobs(requestParameters: PostBlobsRequest, initOverrides?: RequestInit): Promise<void> {
await this.postBlobsRaw(requestParameters, initOverrides);
}
}