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

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

Refactored mapservice

  • mapservice is a connexion python webservice with openapi defined api
  • mapservice-webclient is a angular app, consuming the openapi webservice mapservice
  • Property mode set to 100644
File size: 9.1 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
21import { HttpError } from '../model/httpError';
22import { Water } from '../model/water';
23import { WaterCreation } from '../model/waterCreation';
24
25import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
26import { Configuration } from '../configuration';
27
28
29@Injectable()
30export class WatersService {
31
32 protected basePath = 'https://gnuboat.engsas.com/mapservice/v1';
33 public defaultHeaders = new HttpHeaders();
34 public configuration = new Configuration();
35
36 constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) {
37
38 if (configuration) {
39 this.configuration = configuration;
40 this.configuration.basePath = configuration.basePath || basePath || this.basePath;
41
42 } else {
43 this.configuration.basePath = basePath || this.basePath;
44 }
45 }
46
47 /**
48 * @param consumes string[] mime-types
49 * @return true: consumes contains 'multipart/form-data', false: otherwise
50 */
51 private canConsumeForm(consumes: string[]): boolean {
52 const form = 'multipart/form-data';
53 for (const consume of consumes) {
54 if (form === consume) {
55 return true;
56 }
57 }
58 return false;
59 }
60
61
62 /**
63 * Represents a water
64 * Returns the water identified by id
65 * @param id Item ID
66 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
67 * @param reportProgress flag to report request and response progress.
68 */
69 public waterGetById(id: number, observe?: 'body', reportProgress?: boolean): Observable<Water>;
70 public waterGetById(id: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>;
71 public waterGetById(id: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>;
72 public waterGetById(id: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
73 if (id === null || id === undefined) {
74 throw new Error('Required parameter id was null or undefined when calling waterGetById.');
75 }
76
77 let headers = this.defaultHeaders;
78
79 // to determine the Accept header
80 const httpHeaderAccepts: string[] = [
81 'application/json'
82 ];
83 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
84 if (httpHeaderAcceptSelected !== undefined) {
85 headers = headers.set('Accept', httpHeaderAcceptSelected);
86 }
87
88 // to determine the Content-Type header
89 const consumes: string[] = [
90 ];
91
92 return this.httpClient.get<Water>(`${this.configuration.basePath}/waters/${encodeURIComponent(String(id))}`,
93 {
94 withCredentials: this.configuration.withCredentials,
95 headers: headers,
96 observe: observe,
97 reportProgress: reportProgress
98 }
99 );
100 }
101
102 /**
103 * Add a new water
104 * Adds a new water to the database
105 * @param waterCreation
106 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
107 * @param reportProgress flag to report request and response progress.
108 */
109 public watersCreate(waterCreation?: WaterCreation, observe?: 'body', reportProgress?: boolean): Observable<Water>;
110 public watersCreate(waterCreation?: WaterCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Water>>;
111 public watersCreate(waterCreation?: WaterCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Water>>;
112 public watersCreate(waterCreation?: WaterCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
113
114 let headers = this.defaultHeaders;
115
116 // authentication (apiKeyAuth) required
117 if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
118 headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
119 }
120
121 // authentication (basicAuth) required
122 if (this.configuration.username || this.configuration.password) {
123 headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
124 }
125 // to determine the Accept header
126 const httpHeaderAccepts: string[] = [
127 'application/json'
128 ];
129 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
130 if (httpHeaderAcceptSelected !== undefined) {
131 headers = headers.set('Accept', httpHeaderAcceptSelected);
132 }
133
134 // to determine the Content-Type header
135 const consumes: string[] = [
136 'application/json'
137 ];
138 const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
139 if (httpContentTypeSelected !== undefined) {
140 headers = headers.set('Content-Type', httpContentTypeSelected);
141 }
142
143 return this.httpClient.post<Water>(`${this.configuration.basePath}/waters`,
144 waterCreation,
145 {
146 withCredentials: this.configuration.withCredentials,
147 headers: headers,
148 observe: observe,
149 reportProgress: reportProgress
150 }
151 );
152 }
153
154 /**
155 * Find waters by id
156 * Returns all waters
157 * @param name
158 * @param manager
159 * @param orderBy Order by field: name
160 * @param offset Skip over a number of elements by specifying an offset value for the query
161 * @param limit Limit the number of elements on the response
162 * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
163 * @param reportProgress flag to report request and response progress.
164 */
165 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<Array<Water>>;
166 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<Water>>>;
167 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<Water>>>;
168 public watersGet(name?: string, manager?: string, orderBy?: string, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
169
170 let queryParameters = new HttpParams({encoder: new CustomHttpUrlEncodingCodec()});
171 if (manager !== undefined && manager !== null) {
172 queryParameters = queryParameters.set('manager', <any>manager);
173 }
174 if (orderBy !== undefined && orderBy !== null) {
175 queryParameters = queryParameters.set('orderBy', <any>orderBy);
176 }
177 if (offset !== undefined && offset !== null) {
178 queryParameters = queryParameters.set('offset', <any>offset);
179 }
180 if (limit !== undefined && limit !== null) {
181 queryParameters = queryParameters.set('limit', <any>limit);
182 }
183
184 let headers = this.defaultHeaders;
185 if (name !== undefined && name !== null) {
186 headers = headers.set('name', String(name));
187 }
188
189 // to determine the Accept header
190 const httpHeaderAccepts: string[] = [
191 'application/json'
192 ];
193 const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
194 if (httpHeaderAcceptSelected !== undefined) {
195 headers = headers.set('Accept', httpHeaderAcceptSelected);
196 }
197
198 // to determine the Content-Type header
199 const consumes: string[] = [
200 ];
201
202 return this.httpClient.get<Array<Water>>(`${this.configuration.basePath}/waters`,
203 {
204 params: queryParameters,
205 withCredentials: this.configuration.withCredentials,
206 headers: headers,
207 observe: observe,
208 reportProgress: reportProgress
209 }
210 );
211 }
212
213}
Note: See TracBrowser for help on using the repository browser.