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

debian/bullseye
Last change on this file since 1cd45dd was 13cbe66, checked in by Joachim Langenbach <joachim.langenbach@…>, 8 years ago

Gauges could be added now

  • Property mode set to 100644
File size: 17.5 KB
RevLine 
[5e4cb73]1/**
2 * GNUBoat Mapservice API
3 * API to upload log files with water depth to GNUBoat server
4 *
5 * OpenAPI spec version: 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 } from '@angular/common/http';
17import { CustomHttpUrlEncodingCodec } from '../encoder';
18
19import { Observable } from 'rxjs/Observable';
20
[13cbe66]21import { Gauge } from '../model/gauge';
22import { GaugeCreation } from '../model/gaugeCreation';
[5e4cb73]23import { HttpError } from '../model/httpError';
24import { Water } from '../model/water';
25import { WaterCreation } from '../model/waterCreation';
26
27import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
28import { Configuration } from '../configuration';
29
30
31@Injectable()
32export class WatersService {
33
34 protected basePath = 'https://gnuboat.engsas.com/mapservice/v1';
35 public defaultHeaders = new HttpHeaders();
36 public configuration = new Configuration();
37
38 constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
39
40 if (configuration) {
41 this.configuration = configuration;
42 this.configuration.basePath = configuration.basePath || basePath || this.basePath;
43
44 } else {
45 this.configuration.basePath = basePath || this.basePath;
46 }
47 }
48
49 /**
50 * @param consumes string[] mime-types
51 * @return true: consumes contains 'multipart/form-data', false: otherwise
52 */
53 private canConsumeForm(consumes: string[]): boolean {
54 const form = 'multipart/form-data';
55 for (const consume of consumes) {
56 if (form === consume) {
57 return true;
58 }
59 }
60 return false;
61 }
62
63
64 /**
[13cbe66]65 * Add a new water
66 * Adds a new water to the database
67 * @param waterCreation
[5e4cb73]68 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
69 * @param reportProgress flag to report request and response progress.
70 */
[13cbe66]71 public watersCreate(waterCreation?: WaterCreation, observe?: 'body', reportProgress?: boolean): Observable<Water>;
72 public watersCreate(waterCreation?: WaterCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>;
73 public watersCreate(waterCreation?: WaterCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>;
74 public watersCreate(waterCreation?: WaterCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
[5e4cb73]75
76 let headers = this.defaultHeaders;
77
[13cbe66]78 // authentication (apiKeyAuth) required
79 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
80 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
81 }
82
83 // authentication (basicAuth) required
84 if (this.configuration.username || this.configuration.password) {
85 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
86 }
[5e4cb73]87 // to determine the Accept header
88 const httpHeaderAccepts: string[] = [
89 'application/json'
90 ];
91 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
92 if (httpHeaderAcceptSelected !== undefined) {
93 headers = headers.set('Accept', httpHeaderAcceptSelected);
94 }
95
96 // to determine the Content-Type header
97 const consumes: string[] = [
[13cbe66]98 'application/json'
[5e4cb73]99 ];
[13cbe66]100 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
101 if (httpContentTypeSelected !== undefined) {
102 headers = headers.set('Content-Type', httpContentTypeSelected);
103 }
[5e4cb73]104
[13cbe66]105 return this.httpClient.post<Water>(`${this.configuration.basePath}/waters`,
106 waterCreation,
[5e4cb73]107 {
108 withCredentials: this.configuration.withCredentials,
109 headers: headers,
110 observe: observe,
111 reportProgress: reportProgress
112 }
113 );
114 }
115
116 /**
117 * Add a new water
[13cbe66]118 * Adds a new gauge for water waterId to the database
119 * @param waterId Water ID
120 * @param gaugeCreation
[5e4cb73]121 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
122 * @param reportProgress flag to report request and response progress.
123 */
[13cbe66]124 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'body', reportProgress?: boolean): Observable<Gauge>;
125 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Gauge>>;
126 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Gauge>>;
127 public watersGaugeCreate(waterId: number, gaugeCreation?: GaugeCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
128 if (waterId === null || waterId === undefined) {
129 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeCreate.');
130 }
[5e4cb73]131
132 let headers = this.defaultHeaders;
133
134 // authentication (apiKeyAuth) required
135 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
136 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
137 }
138
139 // authentication (basicAuth) required
140 if (this.configuration.username || this.configuration.password) {
141 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
142 }
143 // to determine the Accept header
144 const httpHeaderAccepts: string[] = [
[13cbe66]145 'application/json',
146 'application/geo+json'
[5e4cb73]147 ];
148 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
149 if (httpHeaderAcceptSelected !== undefined) {
150 headers = headers.set('Accept', httpHeaderAcceptSelected);
151 }
152
153 // to determine the Content-Type header
154 const consumes: string[] = [
155 'application/json'
156 ];
157 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
158 if (httpContentTypeSelected !== undefined) {
159 headers = headers.set('Content-Type', httpContentTypeSelected);
160 }
161
[13cbe66]162 return this.httpClient.post<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`,
163 gaugeCreation,
164 {
165 withCredentials: this.configuration.withCredentials,
166 headers: headers,
167 observe: observe,
168 reportProgress: reportProgress
169 }
170 );
171 }
172
173 /**
174 * Represents a gauge
175 * Returns the gauge identified by id
176 * @param waterId Water ID
177 * @param gaugeId Gauge ID
178 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
179 * @param reportProgress flag to report request and response progress.
180 */
181 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'body', reportProgress?: boolean): Observable<Gauge>;
182 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Gauge>>;
183 public watersGaugeGetById(waterId: number, gaugeId: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Gauge>>;
184 public watersGaugeGetById(waterId: number, gaugeId: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
185 if (waterId === null || waterId === undefined) {
186 throw new Error('Required parameter waterId was null or undefined when calling watersGaugeGetById.');
187 }
188 if (gaugeId === null || gaugeId === undefined) {
189 throw new Error('Required parameter gaugeId was null or undefined when calling watersGaugeGetById.');
190 }
191
192 let headers = this.defaultHeaders;
193
194 // to determine the Accept header
195 const httpHeaderAccepts: string[] = [
196 'application/json',
197 'application/geo+json'
198 ];
199 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
200 if (httpHeaderAcceptSelected !== undefined) {
201 headers = headers.set('Accept', httpHeaderAcceptSelected);
202 }
203
204 // to determine the Content-Type header
205 const consumes: string[] = [
206 ];
207
208 return this.httpClient.get<Gauge>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges/${encodeURIComponent(String(gaugeId))}`,
209 {
210 withCredentials: this.configuration.withCredentials,
211 headers: headers,
212 observe: observe,
213 reportProgress: reportProgress
214 }
215 );
216 }
217
218 /**
219 * Find gauges of water waterId by gaugeId
220 * Returns all gauges of water waterId
221 * @param waterId Water ID
222 * @param name
223 * @param manager
224 * @param orderBy Order by field: name
225 * @param offset Skip over a number of elements by specifying an offset value for the query
226 * @param limit Limit the number of elements on the response
227 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
228 * @param reportProgress flag to report request and response progress.
229 */
230 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<Array<Gauge>>;
231 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Gauge>>>;
232 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Gauge>>>;
233 public watersGaugesGet(waterId: number, name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
234 if (waterId === null || waterId === undefined) {
235 throw new Error('Required parameter waterId was null or undefined when calling watersGaugesGet.');
236 }
237
238 let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
239 if (name !== undefined && name !== null) {
240 queryParameters = queryParameters.set('name', <any>name);
241 }
242 if (manager !== undefined && manager !== null) {
243 queryParameters = queryParameters.set('manager', <any>manager);
244 }
245 if (orderBy !== undefined && orderBy !== null) {
246 queryParameters = queryParameters.set('orderBy', <any>orderBy);
247 }
248 if (offset !== undefined && offset !== null) {
249 queryParameters = queryParameters.set('offset', <any>offset);
250 }
251 if (limit !== undefined && limit !== null) {
252 queryParameters = queryParameters.set('limit', <any>limit);
253 }
254
255 let headers = this.defaultHeaders;
256
257 // to determine the Accept header
258 const httpHeaderAccepts: string[] = [
259 'application/json',
260 'application/geo+json'
261 ];
262 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
263 if (httpHeaderAcceptSelected !== undefined) {
264 headers = headers.set('Accept', httpHeaderAcceptSelected);
265 }
266
267 // to determine the Content-Type header
268 const consumes: string[] = [
269 ];
270
271 return this.httpClient.get<Array<Gauge>>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(waterId))}/gauges`,
[5e4cb73]272 {
[13cbe66]273 params: queryParameters,
[5e4cb73]274 withCredentials: this.configuration.withCredentials,
275 headers: headers,
276 observe: observe,
277 reportProgress: reportProgress
278 }
279 );
280 }
281
282 /**
283 * Find waters by id
284 * Returns all waters
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 watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<Array<Water>>;
294 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Water>>>;
295 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Water>>>;
296 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
297
298 let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
[be25db1]299 if (name !== undefined && name !== null) {
300 queryParameters = queryParameters.set('name', <any>name);
301 }
[5e4cb73]302 if (manager !== undefined && manager !== null) {
303 queryParameters = queryParameters.set('manager', <any>manager);
304 }
305 if (orderBy !== undefined && orderBy !== null) {
306 queryParameters = queryParameters.set('orderBy', <any>orderBy);
307 }
308 if (offset !== undefined && offset !== null) {
309 queryParameters = queryParameters.set('offset', <any>offset);
310 }
311 if (limit !== undefined && limit !== null) {
312 queryParameters = queryParameters.set('limit', <any>limit);
313 }
314
315 let headers = this.defaultHeaders;
316
317 // to determine the Accept header
318 const httpHeaderAccepts: string[] = [
319 'application/json'
320 ];
321 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
322 if (httpHeaderAcceptSelected !== undefined) {
323 headers = headers.set('Accept', httpHeaderAcceptSelected);
324 }
325
326 // to determine the Content-Type header
327 const consumes: string[] = [
328 ];
329
330 return this.httpClient.get<Array<Water>>(`${this.configuration.basePath}/waters`,
331 {
332 params: queryParameters,
333 withCredentials: this.configuration.withCredentials,
334 headers: headers,
335 observe: observe,
336 reportProgress: reportProgress
337 }
338 );
339 }
340
[13cbe66]341 /**
342 * Represents a water
343 * Returns the water identified by id
344 * @param id Item ID
345 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
346 * @param reportProgress flag to report request and response progress.
347 */
348 public watersGetById(id: number, observe?: 'body', reportProgress?: boolean): Observable<Water>;
349 public watersGetById(id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>;
350 public watersGetById(id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>;
351 public watersGetById(id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
352 if (id === null || id === undefined) {
353 throw new Error('Required parameter id was null or undefined when calling watersGetById.');
354 }
355
356 let headers = this.defaultHeaders;
357
358 // to determine the Accept header
359 const httpHeaderAccepts: string[] = [
360 'application/json'
361 ];
362 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
363 if (httpHeaderAcceptSelected !== undefined) {
364 headers = headers.set('Accept', httpHeaderAcceptSelected);
365 }
366
367 // to determine the Content-Type header
368 const consumes: string[] = [
369 ];
370
371 return this.httpClient.get<Water>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(id))}`,
372 {
373 withCredentials: this.configuration.withCredentials,
374 headers: headers,
375 observe: observe,
376 reportProgress: reportProgress
377 }
378 );
379 }
380
[5e4cb73]381}
Note: See TracBrowser for help on using the repository browser.