source: src/mapservice-webclient/src-gen/gnuboat-mapservice/api/users.service.ts@ af6ade4

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