source: src/mapservice-webclient/src-gen/gnuboat-mapservice/api/waters.service.ts@ d660d75

debian/bullseye
Last change on this file since d660d75 was d660d75, checked in by Joachim Langenbach <joachim.langenbach@…>, 6 years ago

Added all generated code to the soruce tree, to avoid generation during package build time

  • Property mode set to 100644
File size: 23.7 KB
RevLine 
[d660d75]1/**
2 * GNUBoat Mapservice API
3 * API to upload log files with water depth to GNUBoat server
4 *
5 * The version of the OpenAPI document: v1
6 * Contact: info@engsas.de
7 *
8 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9 * https://openapi-generator.tech
10 * Do not edit the class manually.
11 */
12/* tslint:disable:no-unused-variable member-ordering */
13
14import { Inject, Injectable, Optional } from '@angular/core';
15import { HttpClient, HttpHeaders, HttpParams,
16 HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http';
17import { CustomHttpParameterCodec } from '../encoder';
18import { Observable } from 'rxjs';
19
20import { Gauge } from '../model/models';
21import { GaugeCreation } from '../model/models';
22import { HttpError } from '../model/models';
23import { Water } from '../model/models';
24import { WaterCreation } from '../model/models';
25
26import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
27import { Configuration } from '../configuration';
28
29
30
31@Injectable({
32 providedIn: 'root'
33})
34export class WatersService {
35
36 protected basePath = 'https://gnuboat.engsas.com/mapservice/v1';
37 public defaultHeaders = new HttpHeaders();
38 public configuration = new Configuration();
39 public encoder: HttpParameterCodec;
40
41 constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
42 if (configuration) {
43 this.configuration = configuration;
44 }
45 if (typeof this.configuration.basePath !== 'string') {
46 if (typeof basePath !== 'string') {
47 basePath = this.basePath;
48 }
49 this.configuration.basePath = basePath;
50 }
51 this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
52 }
53
54
55
56 private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
57 if (typeof value === "object" && value instanceof Date === false) {
58 httpParams = this.addToHttpParamsRecursive(httpParams, value);
59 } else {
60 httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
61 }
62 return httpParams;
63 }
64
65 private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
66 if (value == null) {
67 return httpParams;
68 }
69
70 if (typeof value === "object") {
71 if (Array.isArray(value)) {
72 (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
73 } else if (value instanceof Date) {
74 if (key != null) {
75 httpParams = httpParams.append(key,
76 (value as Date).toISOString().substr(0, 10));
77 } else {
78 throw Error("key may not be null if value is Date");
79 }
80 } else {
81 Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
82 httpParams, value[k], key != null ? `${key}.${k}` : k));
83 }
84 } else if (key != null) {
85 httpParams = httpParams.append(key, value);
86 } else {
87 throw Error("key may not be null if value is not object or array");
88 }
89 return httpParams;
90 }
91
92 /**
93 * Add a new water
94 * Adds a new water to the database
95 * @param waterCreation
96 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
97 * @param reportProgress flag to report request and response progress.
98 */
99 public watersCreate(waterCreation?: WaterCreation, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<Water>;
100 public watersCreate(waterCreation?: WaterCreation, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<Water>>;
101 public watersCreate(waterCreation?: WaterCreation, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<Water>>;
102 public watersCreate(waterCreation?: WaterCreation, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
103
104 let headers = this.defaultHeaders;
105
106 // authentication (apiKeyAuth) required
107 if (this.configuration.apiKeys) {
108 const key: string | undefined = this.configuration.apiKeys["apiKeyAuth"] || this.configuration.apiKeys["X-API-KEY"];
109 if (key) {
110 headers = headers.set('X-API-KEY', key);
111 }
112 }
113
114 // authentication (basicAuth) required
115 if (this.configuration.username || this.configuration.password) {
116 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
117 }
118 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
119 if (httpHeaderAcceptSelected === undefined) {
120 // to determine the Accept header
121 const httpHeaderAccepts: string[] = [
122 'application/json',
123 'application/problem+json'
124 ];
125 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
126 }
127 if (httpHeaderAcceptSelected !== undefined) {
128 headers = headers.set('Accept', httpHeaderAcceptSelected);
129 }
130
131
132 // to determine the Content-Type header
133 const consumes: string[] = [
134 'application/json'
135 ];
136 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
137 if (httpContentTypeSelected !== undefined) {
138 headers = headers.set('Content-Type', httpContentTypeSelected);
139 }
140
141 let responseType: 'text' | 'json' = 'json';
142 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
143 responseType = 'text';
144 }
145
146 return this.httpClient.post<Water>(`${this.configuration.basePath}/waters`,
147 waterCreation,
148 {
149 responseType: <any>responseType,
150 withCredentials: this.configuration.withCredentials,
151 headers: headers,
152 observe: observe,
153 reportProgress: reportProgress
154 }
155 );
156 }
157
158 /**
159 * Add a new water
160 * Adds a new gauge for water waterId to the database
161 * @param waterId Water ID
162 * @param gaugeCreation
163 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
164 * @param reportProgress flag to report request and response progress.
165 */
166 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<Gauge>;
167 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpResponse<Gauge>>;
168 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpEvent<Gauge>>;
169 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<any> {
170 if (waterId === null || waterId === undefined) {
171 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeCreate.');
172 }
173
174 let headers = this.defaultHeaders;
175
176 // authentication (apiKeyAuth) required
177 if (this.configuration.apiKeys) {
178 const key: string | undefined = this.configuration.apiKeys["apiKeyAuth"] || this.configuration.apiKeys["X-API-KEY"];
179 if (key) {
180 headers = headers.set('X-API-KEY', key);
181 }
182 }
183
184 // authentication (basicAuth) required
185 if (this.configuration.username || this.configuration.password) {
186 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
187 }
188 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
189 if (httpHeaderAcceptSelected === undefined) {
190 // to determine the Accept header
191 const httpHeaderAccepts: string[] = [
192 'application/json',
193 'application/geo+json',
194 'application/problem+json'
195 ];
196 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
197 }
198 if (httpHeaderAcceptSelected !== undefined) {
199 headers = headers.set('Accept', httpHeaderAcceptSelected);
200 }
201
202
203 // to determine the Content-Type header
204 const consumes: string[] = [
205 'application/json'
206 ];
207 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
208 if (httpContentTypeSelected !== undefined) {
209 headers = headers.set('Content-Type', httpContentTypeSelected);
210 }
211
212 let responseType: 'text' | 'json' = 'json';
213 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
214 responseType = 'text';
215 }
216
217 return this.httpClient.post<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`,
218 gaugeCreation,
219 {
220 responseType: <any>responseType,
221 withCredentials: this.configuration.withCredentials,
222 headers: headers,
223 observe: observe,
224 reportProgress: reportProgress
225 }
226 );
227 }
228
229 /**
230 * Represents a gauge
231 * Returns the gauge identified by id
232 * @param waterId Water ID
233 * @param gaugeId Gauge ID
234 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
235 * @param reportProgress flag to report request and response progress.
236 */
237 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<Gauge>;
238 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpResponse<Gauge>>;
239 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpEvent<Gauge>>;
240 public watersGaugeGetById(waterId: number, gaugeId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<any> {
241 if (waterId === null || waterId === undefined) {
242 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeGetById.');
243 }
244 if (gaugeId === null || gaugeId === undefined) {
245 throw new Error('Required parameter gaugeId was null or undefined when calling watersGaugeGetById.');
246 }
247
248 let headers = this.defaultHeaders;
249
250 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
251 if (httpHeaderAcceptSelected === undefined) {
252 // to determine the Accept header
253 const httpHeaderAccepts: string[] = [
254 'application/json',
255 'application/geo+json',
256 'application/problem+json'
257 ];
258 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
259 }
260 if (httpHeaderAcceptSelected !== undefined) {
261 headers = headers.set('Accept', httpHeaderAcceptSelected);
262 }
263
264
265 let responseType: 'text' | 'json' = 'json';
266 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
267 responseType = 'text';
268 }
269
270 return this.httpClient.get<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges/${encodeURIComponent(String(gaugeId))}`,
271 {
272 responseType: <any>responseType,
273 withCredentials: this.configuration.withCredentials,
274 headers: headers,
275 observe: observe,
276 reportProgress: reportProgress
277 }
278 );
279 }
280
281 /**
282 * Find gauges of water waterId by gaugeId
283 * Returns all gauges of water waterId
284 * @param waterId Water ID
285 * @param name
286 * @param manager
287 * @param orderBy Order by field: name
288 * @param offset Skip over a number of elements by specifying an offset value for the query
289 * @param limit Limit the number of elements on the response
290 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
291 * @param reportProgress flag to report request and response progress.
292 */
293 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json'}): Observable<Array<Gauge>>;
294 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json'}): Observable<HttpResponse<Array<Gauge>>>;
295 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json'}): Observable<HttpEvent<Array<Gauge>>>;
296 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json'}): Observable<any> {
297 if (waterId === null || waterId === undefined) {
298 throw new Error('Required parameter waterId was null or undefined when calling watersGaugesGet.');
299 }
300
301 let queryParameters = new HttpParams({encoder: this.encoder});
302 if (name !== undefined && name !== null) {
303 queryParameters = this.addToHttpParams(queryParameters,
304 <any>name, 'name');
305 }
306 if (manager !== undefined && manager !== null) {
307 queryParameters = this.addToHttpParams(queryParameters,
308 <any>manager, 'manager');
309 }
310 if (orderBy !== undefined && orderBy !== null) {
311 queryParameters = this.addToHttpParams(queryParameters,
312 <any>orderBy, 'order_by');
313 }
314 if (offset !== undefined && offset !== null) {
315 queryParameters = this.addToHttpParams(queryParameters,
316 <any>offset, 'offset');
317 }
318 if (limit !== undefined && limit !== null) {
319 queryParameters = this.addToHttpParams(queryParameters,
320 <any>limit, 'limit');
321 }
322
323 let headers = this.defaultHeaders;
324
325 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
326 if (httpHeaderAcceptSelected === undefined) {
327 // to determine the Accept header
328 const httpHeaderAccepts: string[] = [
329 'application/json',
330 'application/geo+json'
331 ];
332 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
333 }
334 if (httpHeaderAcceptSelected !== undefined) {
335 headers = headers.set('Accept', httpHeaderAcceptSelected);
336 }
337
338
339 let responseType: 'text' | 'json' = 'json';
340 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
341 responseType = 'text';
342 }
343
344 return this.httpClient.get<Array<Gauge>>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`,
345 {
346 params: queryParameters,
347 responseType: <any>responseType,
348 withCredentials: this.configuration.withCredentials,
349 headers: headers,
350 observe: observe,
351 reportProgress: reportProgress
352 }
353 );
354 }
355
356 /**
357 * Find waters
358 * Returns all waters
359 * @param name
360 * @param manager
361 * @param stakeholder A stakeholder is a user, which has uploaded Logfiles to water, added a gauge, ...
362 * @param orderBy Order by field: name
363 * @param offset Skip over a number of elements by specifying an offset value for the query
364 * @param limit Limit the number of elements on the response
365 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
366 * @param reportProgress flag to report request and response progress.
367 */
368 public watersGet(name?: string, manager?: string, stakeholder?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<Array<Water>>;
369 public watersGet(name?: string, manager?: string, stakeholder?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<Array<Water>>>;
370 public watersGet(name?: string, manager?: string, stakeholder?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<Array<Water>>>;
371 public watersGet(name?: string, manager?: string, stakeholder?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
372
373 let queryParameters = new HttpParams({encoder: this.encoder});
374 if (name !== undefined && name !== null) {
375 queryParameters = this.addToHttpParams(queryParameters,
376 <any>name, 'name');
377 }
378 if (manager !== undefined && manager !== null) {
379 queryParameters = this.addToHttpParams(queryParameters,
380 <any>manager, 'manager');
381 }
382 if (stakeholder !== undefined && stakeholder !== null) {
383 queryParameters = this.addToHttpParams(queryParameters,
384 <any>stakeholder, 'stakeholder');
385 }
386 if (orderBy !== undefined && orderBy !== null) {
387 queryParameters = this.addToHttpParams(queryParameters,
388 <any>orderBy, 'order_by');
389 }
390 if (offset !== undefined && offset !== null) {
391 queryParameters = this.addToHttpParams(queryParameters,
392 <any>offset, 'offset');
393 }
394 if (limit !== undefined && limit !== null) {
395 queryParameters = this.addToHttpParams(queryParameters,
396 <any>limit, 'limit');
397 }
398
399 let headers = this.defaultHeaders;
400
401 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
402 if (httpHeaderAcceptSelected === undefined) {
403 // to determine the Accept header
404 const httpHeaderAccepts: string[] = [
405 'application/json',
406 'application/problem+json'
407 ];
408 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
409 }
410 if (httpHeaderAcceptSelected !== undefined) {
411 headers = headers.set('Accept', httpHeaderAcceptSelected);
412 }
413
414
415 let responseType: 'text' | 'json' = 'json';
416 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
417 responseType = 'text';
418 }
419
420 return this.httpClient.get<Array<Water>>(`${this.configuration.basePath}/waters`,
421 {
422 params: queryParameters,
423 responseType: <any>responseType,
424 withCredentials: this.configuration.withCredentials,
425 headers: headers,
426 observe: observe,
427 reportProgress: reportProgress
428 }
429 );
430 }
431
432 /**
433 * Represents a water
434 * Returns the water identified by id
435 * @param id Item ID
436 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
437 * @param reportProgress flag to report request and response progress.
438 */
439 public watersGetById(id: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<Water>;
440 public watersGetById(id: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<Water>>;
441 public watersGetById(id: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<Water>>;
442 public watersGetById(id: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
443 if (id === null || id === undefined) {
444 throw new Error('Required parameter id was null or undefined when calling watersGetById.');
445 }
446
447 let headers = this.defaultHeaders;
448
449 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
450 if (httpHeaderAcceptSelected === undefined) {
451 // to determine the Accept header
452 const httpHeaderAccepts: string[] = [
453 'application/json',
454 'application/problem+json'
455 ];
456 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
457 }
458 if (httpHeaderAcceptSelected !== undefined) {
459 headers = headers.set('Accept', httpHeaderAcceptSelected);
460 }
461
462
463 let responseType: 'text' | 'json' = 'json';
464 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
465 responseType = 'text';
466 }
467
468 return this.httpClient.get<Water>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(id))}`,
469 {
470 responseType: <any>responseType,
471 withCredentials: this.configuration.withCredentials,
472 headers: headers,
473 observe: observe,
474 reportProgress: reportProgress
475 }
476 );
477 }
478
479}
Note: See TracBrowser for help on using the repository browser.