source: src/mapservice-webclient/src-gen/gnuboat-mapservice/api/logs.service.ts@ 5071137

debian/bullseye
Last change on this file since 5071137 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: 19.2 KB
Line 
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 { HttpError } from '../model/models';
21import { Log } from '../model/models';
22import { LogCreation } from '../model/models';
23import { LogMetaData } from '../model/models';
24
25import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
26import { Configuration } from '../configuration';
27
28
29
30@Injectable({
31 providedIn: 'root'
32})
33export class LogsService {
34
35 protected basePath = 'https://gnuboat.engsas.com/mapservice/v1';
36 public defaultHeaders = new HttpHeaders();
37 public configuration = new Configuration();
38 public encoder: HttpParameterCodec;
39
40 constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
41 if (configuration) {
42 this.configuration = configuration;
43 }
44 if (typeof this.configuration.basePath !== 'string') {
45 if (typeof basePath !== 'string') {
46 basePath = this.basePath;
47 }
48 this.configuration.basePath = basePath;
49 }
50 this.encoder = this.configuration.encoder || new CustomHttpParameterCodec();
51 }
52
53
54
55 private addToHttpParams(httpParams: HttpParams, value: any, key?: string): HttpParams {
56 if (typeof value === "object" && value instanceof Date === false) {
57 httpParams = this.addToHttpParamsRecursive(httpParams, value);
58 } else {
59 httpParams = this.addToHttpParamsRecursive(httpParams, value, key);
60 }
61 return httpParams;
62 }
63
64 private addToHttpParamsRecursive(httpParams: HttpParams, value?: any, key?: string): HttpParams {
65 if (value == null) {
66 return httpParams;
67 }
68
69 if (typeof value === "object") {
70 if (Array.isArray(value)) {
71 (value as any[]).forEach( elem => httpParams = this.addToHttpParamsRecursive(httpParams, elem, key));
72 } else if (value instanceof Date) {
73 if (key != null) {
74 httpParams = httpParams.append(key,
75 (value as Date).toISOString().substr(0, 10));
76 } else {
77 throw Error("key may not be null if value is Date");
78 }
79 } else {
80 Object.keys(value).forEach( k => httpParams = this.addToHttpParamsRecursive(
81 httpParams, value[k], key != null ? `${key}.${k}` : k));
82 }
83 } else if (key != null) {
84 httpParams = httpParams.append(key, value);
85 } else {
86 throw Error("key may not be null if value is not object or array");
87 }
88 return httpParams;
89 }
90
91 /**
92 * Find logs by
93 * Returns all log metadata
94 * @param submitter
95 * @param orderBy Order by field: name
96 * @param offset Skip over a number of elements by specifying an offset value for the query
97 * @param limit Limit the number of elements on the response
98 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
99 * @param reportProgress flag to report request and response progress.
100 */
101 public logsGet(submitter?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<Array<LogMetaData>>;
102 public logsGet(submitter?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<Array<LogMetaData>>>;
103 public logsGet(submitter?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<Array<LogMetaData>>>;
104 public logsGet(submitter?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
105
106 let queryParameters = new HttpParams({encoder: this.encoder});
107 if (submitter !== undefined && submitter !== null) {
108 queryParameters = this.addToHttpParams(queryParameters,
109 <any>submitter, 'submitter');
110 }
111 if (orderBy !== undefined && orderBy !== null) {
112 queryParameters = this.addToHttpParams(queryParameters,
113 <any>orderBy, 'order_by');
114 }
115 if (offset !== undefined && offset !== null) {
116 queryParameters = this.addToHttpParams(queryParameters,
117 <any>offset, 'offset');
118 }
119 if (limit !== undefined && limit !== null) {
120 queryParameters = this.addToHttpParams(queryParameters,
121 <any>limit, 'limit');
122 }
123
124 let headers = this.defaultHeaders;
125
126 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
127 if (httpHeaderAcceptSelected === undefined) {
128 // to determine the Accept header
129 const httpHeaderAccepts: string[] = [
130 'application/json',
131 'application/problem+json'
132 ];
133 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
134 }
135 if (httpHeaderAcceptSelected !== undefined) {
136 headers = headers.set('Accept', httpHeaderAcceptSelected);
137 }
138
139
140 let responseType: 'text' | 'json' = 'json';
141 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
142 responseType = 'text';
143 }
144
145 return this.httpClient.get<Array<LogMetaData>>(`${this.configuration.basePath}/logs`,
146 {
147 params: queryParameters,
148 responseType: <any>responseType,
149 withCredentials: this.configuration.withCredentials,
150 headers: headers,
151 observe: observe,
152 reportProgress: reportProgress
153 }
154 );
155 }
156
157 /**
158 * Add a new log
159 * Creates a new log from given meta data. The log entries itself, must be uploaded per /logs/{log_id}
160 * @param logCreation
161 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
162 * @param reportProgress flag to report request and response progress.
163 */
164 public logsLogCreate(logCreation?: LogCreation, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<LogMetaData>;
165 public logsLogCreate(logCreation?: LogCreation, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<LogMetaData>>;
166 public logsLogCreate(logCreation?: LogCreation, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<LogMetaData>>;
167 public logsLogCreate(logCreation?: LogCreation, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
168
169 let headers = this.defaultHeaders;
170
171 // authentication (apiKeyAuth) required
172 if (this.configuration.apiKeys) {
173 const key: string | undefined = this.configuration.apiKeys["apiKeyAuth"] || this.configuration.apiKeys["X-API-KEY"];
174 if (key) {
175 headers = headers.set('X-API-KEY', key);
176 }
177 }
178
179 // authentication (basicAuth) required
180 if (this.configuration.username || this.configuration.password) {
181 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
182 }
183 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
184 if (httpHeaderAcceptSelected === undefined) {
185 // to determine the Accept header
186 const httpHeaderAccepts: string[] = [
187 'application/json',
188 'application/problem+json'
189 ];
190 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
191 }
192 if (httpHeaderAcceptSelected !== undefined) {
193 headers = headers.set('Accept', httpHeaderAcceptSelected);
194 }
195
196
197 // to determine the Content-Type header
198 const consumes: string[] = [
199 'application/json'
200 ];
201 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
202 if (httpContentTypeSelected !== undefined) {
203 headers = headers.set('Content-Type', httpContentTypeSelected);
204 }
205
206 let responseType: 'text' | 'json' = 'json';
207 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
208 responseType = 'text';
209 }
210
211 return this.httpClient.post<LogMetaData>(`${this.configuration.basePath}/logs`,
212 logCreation,
213 {
214 responseType: <any>responseType,
215 withCredentials: this.configuration.withCredentials,
216 headers: headers,
217 observe: observe,
218 reportProgress: reportProgress
219 }
220 );
221 }
222
223 /**
224 * Deletes log
225 * Deletes given log and returns remaining logs of the gauge
226 * @param logId Log ID
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 logsLogDelete(logId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<Array<LogMetaData>>;
231 public logsLogDelete(logId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<Array<LogMetaData>>>;
232 public logsLogDelete(logId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<Array<LogMetaData>>>;
233 public logsLogDelete(logId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
234 if (logId === null || logId === undefined) {
235 throw new Error('Required parameter logId was null or undefined when calling logsLogDelete.');
236 }
237
238 let headers = this.defaultHeaders;
239
240 // authentication (apiKeyAuth) required
241 if (this.configuration.apiKeys) {
242 const key: string | undefined = this.configuration.apiKeys["apiKeyAuth"] || this.configuration.apiKeys["X-API-KEY"];
243 if (key) {
244 headers = headers.set('X-API-KEY', key);
245 }
246 }
247
248 // authentication (basicAuth) required
249 if (this.configuration.username || this.configuration.password) {
250 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
251 }
252 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
253 if (httpHeaderAcceptSelected === undefined) {
254 // to determine the Accept header
255 const httpHeaderAccepts: string[] = [
256 'application/json',
257 'application/problem+json'
258 ];
259 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
260 }
261 if (httpHeaderAcceptSelected !== undefined) {
262 headers = headers.set('Accept', httpHeaderAcceptSelected);
263 }
264
265
266 let responseType: 'text' | 'json' = 'json';
267 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
268 responseType = 'text';
269 }
270
271 return this.httpClient.delete<Array<LogMetaData>>(`${this.configuration.basePath}/logs/${encodeURIComponent(String(logId))}`,
272 {
273 responseType: <any>responseType,
274 withCredentials: this.configuration.withCredentials,
275 headers: headers,
276 observe: observe,
277 reportProgress: reportProgress
278 }
279 );
280 }
281
282 /**
283 * Represents a log
284 * Returns the log identified by id
285 * @param logId Log ID
286 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
287 * @param reportProgress flag to report request and response progress.
288 */
289 public logsLogGetById(logId: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<Log>;
290 public logsLogGetById(logId: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpResponse<Log>>;
291 public logsLogGetById(logId: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<HttpEvent<Log>>;
292 public logsLogGetById(logId: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/geo+json' | 'application/problem+json'}): Observable<any> {
293 if (logId === null || logId === undefined) {
294 throw new Error('Required parameter logId was null or undefined when calling logsLogGetById.');
295 }
296
297 let headers = this.defaultHeaders;
298
299 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
300 if (httpHeaderAcceptSelected === undefined) {
301 // to determine the Accept header
302 const httpHeaderAccepts: string[] = [
303 'application/json',
304 'application/geo+json',
305 'application/problem+json'
306 ];
307 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
308 }
309 if (httpHeaderAcceptSelected !== undefined) {
310 headers = headers.set('Accept', httpHeaderAcceptSelected);
311 }
312
313
314 let responseType: 'text' | 'json' = 'json';
315 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
316 responseType = 'text';
317 }
318
319 return this.httpClient.get<Log>(`${this.configuration.basePath}/logs/${encodeURIComponent(String(logId))}`,
320 {
321 responseType: <any>responseType,
322 withCredentials: this.configuration.withCredentials,
323 headers: headers,
324 observe: observe,
325 reportProgress: reportProgress
326 }
327 );
328 }
329
330 /**
331 * Add a new log entries
332 * Adds log entries from uploaded file to current Log
333 * @param logId Log ID
334 * @param body
335 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
336 * @param reportProgress flag to report request and response progress.
337 */
338 public logsLogUpload(logId: number, body?: Blob, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<LogMetaData>;
339 public logsLogUpload(logId: number, body?: Blob, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpResponse<LogMetaData>>;
340 public logsLogUpload(logId: number, body?: Blob, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<HttpEvent<LogMetaData>>;
341 public logsLogUpload(logId: number, body?: Blob, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json' | 'application/problem+json'}): Observable<any> {
342 if (logId === null || logId === undefined) {
343 throw new Error('Required parameter logId was null or undefined when calling logsLogUpload.');
344 }
345
346 let headers = this.defaultHeaders;
347
348 // authentication (apiKeyAuth) required
349 if (this.configuration.apiKeys) {
350 const key: string | undefined = this.configuration.apiKeys["apiKeyAuth"] || this.configuration.apiKeys["X-API-KEY"];
351 if (key) {
352 headers = headers.set('X-API-KEY', key);
353 }
354 }
355
356 // authentication (basicAuth) required
357 if (this.configuration.username || this.configuration.password) {
358 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
359 }
360 let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept;
361 if (httpHeaderAcceptSelected === undefined) {
362 // to determine the Accept header
363 const httpHeaderAccepts: string[] = [
364 'application/json',
365 'application/problem+json'
366 ];
367 httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts);
368 }
369 if (httpHeaderAcceptSelected !== undefined) {
370 headers = headers.set('Accept', httpHeaderAcceptSelected);
371 }
372
373
374 // to determine the Content-Type header
375 const consumes: string[] = [
376 'text/plain'
377 ];
378 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
379 if (httpContentTypeSelected !== undefined) {
380 headers = headers.set('Content-Type', httpContentTypeSelected);
381 }
382
383 let responseType: 'text' | 'json' = 'json';
384 if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) {
385 responseType = 'text';
386 }
387
388 return this.httpClient.post<LogMetaData>(`${this.configuration.basePath}/logs/${encodeURIComponent(String(logId))}`,
389 body,
390 {
391 responseType: <any>responseType,
392 withCredentials: this.configuration.withCredentials,
393 headers: headers,
394 observe: observe,
395 reportProgress: reportProgress
396 }
397 );
398 }
399
400}
Note: See TracBrowser for help on using the repository browser.