UNPKG

cwmsjs

Version:

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

161 lines (131 loc) 5.46 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 { Catalog, CatalogFromJSON, CatalogToJSON, CatalogableEndpoint, CatalogableEndpointFromJSON, CatalogableEndpointToJSON, CdaError, CdaErrorFromJSON, CdaErrorToJSON, UnitSystem, UnitSystemFromJSON, UnitSystemToJSON, } from '../models'; export interface GetCatalogWithDatasetRequest { dataset: CatalogableEndpoint; page?: string; pageSize?: number; unitSystem?: UnitSystem; office?: string; like?: string; timeseriesCategoryLike?: string; timeseriesGroupLike?: string; locationCategoryLike?: string; locationGroupLike?: string; boundingOfficeLike?: string; includeExtents?: boolean; excludeEmpty?: boolean; locationKindLike?: string; filterBaseLocations?: boolean; negateLocationKindLike?: string; locationTypeLike?: string; includeAliases?: boolean; } /** * */ export class CatalogApi extends runtime.BaseAPI { /** * Get catalog with dataset */ async getCatalogWithDatasetRaw(requestParameters: GetCatalogWithDatasetRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<Catalog>> { if (requestParameters.dataset === null || requestParameters.dataset === undefined) { throw new runtime.RequiredError('dataset','Required parameter requestParameters.dataset was null or undefined when calling getCatalogWithDataset.'); } const queryParameters: any = {}; if (requestParameters.page !== undefined) { queryParameters['page'] = requestParameters.page; } if (requestParameters.pageSize !== undefined) { queryParameters['page-size'] = requestParameters.pageSize; } if (requestParameters.unitSystem !== undefined) { queryParameters['unit-system'] = requestParameters.unitSystem; } if (requestParameters.office !== undefined) { queryParameters['office'] = requestParameters.office; } if (requestParameters.like !== undefined) { queryParameters['like'] = requestParameters.like; } if (requestParameters.timeseriesCategoryLike !== undefined) { queryParameters['timeseries-category-like'] = requestParameters.timeseriesCategoryLike; } if (requestParameters.timeseriesGroupLike !== undefined) { queryParameters['timeseries-group-like'] = requestParameters.timeseriesGroupLike; } if (requestParameters.locationCategoryLike !== undefined) { queryParameters['location-category-like'] = requestParameters.locationCategoryLike; } if (requestParameters.locationGroupLike !== undefined) { queryParameters['location-group-like'] = requestParameters.locationGroupLike; } if (requestParameters.boundingOfficeLike !== undefined) { queryParameters['bounding-office-like'] = requestParameters.boundingOfficeLike; } if (requestParameters.includeExtents !== undefined) { queryParameters['include-extents'] = requestParameters.includeExtents; } if (requestParameters.excludeEmpty !== undefined) { queryParameters['exclude-empty'] = requestParameters.excludeEmpty; } if (requestParameters.locationKindLike !== undefined) { queryParameters['location-kind-like'] = requestParameters.locationKindLike; } if (requestParameters.filterBaseLocations !== undefined) { queryParameters['filter-base-locations'] = requestParameters.filterBaseLocations; } if (requestParameters.negateLocationKindLike !== undefined) { queryParameters['negate-location-kind-like'] = requestParameters.negateLocationKindLike; } if (requestParameters.locationTypeLike !== undefined) { queryParameters['location-type-like'] = requestParameters.locationTypeLike; } if (requestParameters.includeAliases !== undefined) { queryParameters['include-aliases'] = requestParameters.includeAliases; } const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.apiKey) { headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication } const response = await this.request({ path: `/catalog/{dataset}`.replace(`{${"dataset"}}`, encodeURIComponent(String(requestParameters.dataset))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => CatalogFromJSON(jsonValue)); } /** * Get catalog with dataset */ async getCatalogWithDataset(requestParameters: GetCatalogWithDatasetRequest, initOverrides?: RequestInit): Promise<Catalog> { const response = await this.getCatalogWithDatasetRaw(requestParameters, initOverrides); return await response.value(); } }