cwmsjs
Version:
CWMS Data API Library for JavaScript/TypeScript created with OpenAPI generator for use with browser webapps
92 lines (75 loc) • 3.06 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 {
CdaError,
CdaErrorFromJSON,
CdaErrorToJSON,
RssFeed,
RssFeedFromJSON,
RssFeedToJSON,
} from '../models';
export interface GetRssWithOfficeWithNameRequest {
office: string;
name: string;
since?: string;
pageSize?: number;
page?: string;
}
/**
*
*/
export class RSSApi extends runtime.BaseAPI {
/**
* Returns RSS feed items limited to the last week.
* Get rss with office with name
*/
async getRssWithOfficeWithNameRaw(requestParameters: GetRssWithOfficeWithNameRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<RssFeed>> {
if (requestParameters.office === null || requestParameters.office === undefined) {
throw new runtime.RequiredError('office','Required parameter requestParameters.office was null or undefined when calling getRssWithOfficeWithName.');
}
if (requestParameters.name === null || requestParameters.name === undefined) {
throw new runtime.RequiredError('name','Required parameter requestParameters.name was null or undefined when calling getRssWithOfficeWithName.');
}
const queryParameters: any = {};
if (requestParameters.since !== undefined) {
queryParameters['since'] = requestParameters.since;
}
if (requestParameters.pageSize !== undefined) {
queryParameters['page-size'] = requestParameters.pageSize;
}
if (requestParameters.page !== undefined) {
queryParameters['page'] = requestParameters.page;
}
const headerParameters: runtime.HTTPHeaders = {};
if (this.configuration && this.configuration.apiKey) {
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // ApiKey authentication
}
const response = await this.request({
path: `/rss/{office}/{name}`.replace(`{${"office"}}`, encodeURIComponent(String(requestParameters.office))).replace(`{${"name"}}`, encodeURIComponent(String(requestParameters.name))),
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RssFeedFromJSON(jsonValue));
}
/**
* Returns RSS feed items limited to the last week.
* Get rss with office with name
*/
async getRssWithOfficeWithName(requestParameters: GetRssWithOfficeWithNameRequest, initOverrides?: RequestInit): Promise<RssFeed> {
const response = await this.getRssWithOfficeWithNameRaw(requestParameters, initOverrides);
return await response.value();
}
}