| [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 |
|
|---|
| 14 | import { Inject, Injectable, Optional } from '@angular/core';
|
|---|
| 15 | import { HttpClient, HttpHeaders, HttpParams,
|
|---|
| 16 | HttpResponse, HttpEvent } from '@angular/common/http';
|
|---|
| 17 | import { CustomHttpUrlEncodingCodec } from '../encoder';
|
|---|
| 18 |
|
|---|
| 19 | import { Observable } from 'rxjs/Observable';
|
|---|
| 20 |
|
|---|
| 21 | import { HttpError } from '../model/httpError';
|
|---|
| 22 | import { User } from '../model/user';
|
|---|
| 23 | import { UserCreation } from '../model/userCreation';
|
|---|
| 24 |
|
|---|
| 25 | import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
|
|---|
| 26 | import { Configuration } from '../configuration';
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | @Injectable()
|
|---|
| 30 | export class UsersService {
|
|---|
| 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 | *
|
|---|
| 64 | * Used by CORS preflight
|
|---|
| 65 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 66 | * @param reportProgress flag to report request and response progress.
|
|---|
| 67 | */
|
|---|
| 68 | public userOptions(observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|---|
| 69 | public userOptions(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
|---|
| 70 | public userOptions(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
|---|
| 71 | public userOptions(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 72 |
|
|---|
| 73 | let headers = this.defaultHeaders;
|
|---|
| 74 |
|
|---|
| 75 | // to determine the Accept header
|
|---|
| 76 | const httpHeaderAccepts: string[] = [
|
|---|
| 77 | 'application/json'
|
|---|
| 78 | ];
|
|---|
| 79 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 80 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 81 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | // to determine the Content-Type header
|
|---|
| 85 | const consumes: string[] = [
|
|---|
| 86 | ];
|
|---|
| 87 |
|
|---|
| 88 | return this.httpClient.options<any>(`${this.configuration.basePath}/user`,
|
|---|
| 89 | {
|
|---|
| 90 | withCredentials: this.configuration.withCredentials,
|
|---|
| 91 | headers: headers,
|
|---|
| 92 | observe: observe,
|
|---|
| 93 | reportProgress: reportProgress
|
|---|
| 94 | }
|
|---|
| 95 | );
|
|---|
| 96 | }
|
|---|
| 97 |
|
|---|
| 98 | /**
|
|---|
| 99 | * Activates a user account
|
|---|
| 100 | * Activates a user account
|
|---|
| 101 | * @param activationCode Activation code
|
|---|
| 102 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 103 | * @param reportProgress flag to report request and response progress.
|
|---|
| 104 | */
|
|---|
| 105 | public usersActivate(activationCode: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|---|
| 106 | public usersActivate(activationCode: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
|---|
| 107 | public usersActivate(activationCode: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
|---|
| 108 | public usersActivate(activationCode: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 109 | if (activationCode === null || activationCode === undefined) {
|
|---|
| 110 | throw new Error('Required parameter activationCode was null or undefined when calling usersActivate.');
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | let headers = this.defaultHeaders;
|
|---|
| 114 |
|
|---|
| 115 | // to determine the Accept header
|
|---|
| 116 | const httpHeaderAccepts: string[] = [
|
|---|
| 117 | ];
|
|---|
| 118 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 119 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 120 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | // to determine the Content-Type header
|
|---|
| 124 | const consumes: string[] = [
|
|---|
| 125 | ];
|
|---|
| 126 |
|
|---|
| 127 | return this.httpClient.get<any>(`${this.configuration.basePath}/user/activate/${encodeURIComponent(String(activationCode))}`,
|
|---|
| 128 | {
|
|---|
| 129 | withCredentials: this.configuration.withCredentials,
|
|---|
| 130 | headers: headers,
|
|---|
| 131 | observe: observe,
|
|---|
| 132 | reportProgress: reportProgress
|
|---|
| 133 | }
|
|---|
| 134 | );
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | /**
|
|---|
| 138 | * Returns a new API key
|
|---|
| 139 | * Generates and returns a new API key for current user
|
|---|
| 140 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 141 | * @param reportProgress flag to report request and response progress.
|
|---|
| 142 | */
|
|---|
| 143 | public usersApiKeyCreate(observe?: 'body', reportProgress?: boolean): Observable<string>;
|
|---|
| 144 | public usersApiKeyCreate(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<string>>;
|
|---|
| 145 | public usersApiKeyCreate(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<string>>;
|
|---|
| 146 | public usersApiKeyCreate(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 147 |
|
|---|
| 148 | let headers = this.defaultHeaders;
|
|---|
| 149 |
|
|---|
| 150 | // authentication (apiKeyAuth) required
|
|---|
| 151 | if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
|
|---|
| 152 | headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | // authentication (basicAuth) required
|
|---|
| 156 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 157 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 158 | }
|
|---|
| 159 | // to determine the Accept header
|
|---|
| 160 | const httpHeaderAccepts: string[] = [
|
|---|
| 161 | 'application/json'
|
|---|
| 162 | ];
|
|---|
| 163 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 164 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 165 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | // to determine the Content-Type header
|
|---|
| 169 | const consumes: string[] = [
|
|---|
| 170 | ];
|
|---|
| 171 |
|
|---|
| 172 | return this.httpClient.get<string>(`${this.configuration.basePath}/user/apikey_create`,
|
|---|
| 173 | {
|
|---|
| 174 | withCredentials: this.configuration.withCredentials,
|
|---|
| 175 | headers: headers,
|
|---|
| 176 | observe: observe,
|
|---|
| 177 | reportProgress: reportProgress
|
|---|
| 178 | }
|
|---|
| 179 | );
|
|---|
| 180 | }
|
|---|
| 181 |
|
|---|
| 182 | /**
|
|---|
| 183 | * Deletes API key
|
|---|
| 184 | * Deletes given API key and returns remaining API keys of the user
|
|---|
| 185 | * @param apiKey API key
|
|---|
| 186 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 187 | * @param reportProgress flag to report request and response progress.
|
|---|
| 188 | */
|
|---|
| 189 | public usersApiKeyDelete(apiKey: string, observe?: 'body', reportProgress?: boolean): Observable<Array<string>>;
|
|---|
| 190 | public usersApiKeyDelete(apiKey: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<string>>>;
|
|---|
| 191 | public usersApiKeyDelete(apiKey: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<string>>>;
|
|---|
| 192 | public usersApiKeyDelete(apiKey: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 193 | if (apiKey === null || apiKey === undefined) {
|
|---|
| 194 | throw new Error('Required parameter apiKey was null or undefined when calling usersApiKeyDelete.');
|
|---|
| 195 | }
|
|---|
| 196 |
|
|---|
| 197 | let headers = this.defaultHeaders;
|
|---|
| 198 |
|
|---|
| 199 | // authentication (apiKeyAuth) required
|
|---|
| 200 | if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
|
|---|
| 201 | headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | // authentication (basicAuth) required
|
|---|
| 205 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 206 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 207 | }
|
|---|
| 208 | // to determine the Accept header
|
|---|
| 209 | const httpHeaderAccepts: string[] = [
|
|---|
| 210 | 'application/json'
|
|---|
| 211 | ];
|
|---|
| 212 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 213 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 214 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 215 | }
|
|---|
| 216 |
|
|---|
| 217 | // to determine the Content-Type header
|
|---|
| 218 | const consumes: string[] = [
|
|---|
| 219 | ];
|
|---|
| 220 |
|
|---|
| 221 | return this.httpClient.delete<Array<string>>(`${this.configuration.basePath}/user/${encodeURIComponent(String(apiKey))}`,
|
|---|
| 222 | {
|
|---|
| 223 | withCredentials: this.configuration.withCredentials,
|
|---|
| 224 | headers: headers,
|
|---|
| 225 | observe: observe,
|
|---|
| 226 | reportProgress: reportProgress
|
|---|
| 227 | }
|
|---|
| 228 | );
|
|---|
| 229 | }
|
|---|
| 230 |
|
|---|
| 231 | /**
|
|---|
| 232 | * Returns info of a user
|
|---|
| 233 | * Returns information for a user
|
|---|
| 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 usersGet(observe?: 'body', reportProgress?: boolean): Observable<User>;
|
|---|
| 238 | public usersGet(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|---|
| 239 | public usersGet(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|---|
| 240 | public usersGet(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 241 |
|
|---|
| 242 | let headers = this.defaultHeaders;
|
|---|
| 243 |
|
|---|
| 244 | // authentication (apiKeyAuth) required
|
|---|
| 245 | if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
|
|---|
| 246 | headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
|
|---|
| 247 | }
|
|---|
| 248 |
|
|---|
| 249 | // authentication (basicAuth) required
|
|---|
| 250 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 251 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 252 | }
|
|---|
| 253 | // to determine the Accept header
|
|---|
| 254 | const httpHeaderAccepts: string[] = [
|
|---|
| 255 | 'application/json'
|
|---|
| 256 | ];
|
|---|
| 257 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 258 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 259 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 260 | }
|
|---|
| 261 |
|
|---|
| 262 | // to determine the Content-Type header
|
|---|
| 263 | const consumes: string[] = [
|
|---|
| 264 | ];
|
|---|
| 265 |
|
|---|
| 266 | return this.httpClient.get<User>(`${this.configuration.basePath}/user`,
|
|---|
| 267 | {
|
|---|
| 268 | withCredentials: this.configuration.withCredentials,
|
|---|
| 269 | headers: headers,
|
|---|
| 270 | observe: observe,
|
|---|
| 271 | reportProgress: reportProgress
|
|---|
| 272 | }
|
|---|
| 273 | );
|
|---|
| 274 | }
|
|---|
| 275 |
|
|---|
| 276 | /**
|
|---|
| 277 | * Registers a new user
|
|---|
| 278 | * Registers a new user
|
|---|
| 279 | * @param userCreation
|
|---|
| 280 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 281 | * @param reportProgress flag to report request and response progress.
|
|---|
| 282 | */
|
|---|
| 283 | public usersRegister(userCreation?: UserCreation, observe?: 'body', reportProgress?: boolean): Observable<User>;
|
|---|
| 284 | public usersRegister(userCreation?: UserCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|---|
| 285 | public usersRegister(userCreation?: UserCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|---|
| 286 | public usersRegister(userCreation?: UserCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 287 |
|
|---|
| 288 | let headers = this.defaultHeaders;
|
|---|
| 289 |
|
|---|
| 290 | // to determine the Accept header
|
|---|
| 291 | const httpHeaderAccepts: string[] = [
|
|---|
| 292 | 'application/json'
|
|---|
| 293 | ];
|
|---|
| 294 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 295 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 296 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 297 | }
|
|---|
| 298 |
|
|---|
| 299 | // to determine the Content-Type header
|
|---|
| 300 | const consumes: string[] = [
|
|---|
| 301 | 'application/json'
|
|---|
| 302 | ];
|
|---|
| 303 | const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|---|
| 304 | if (httpContentTypeSelected !== undefined) {
|
|---|
| 305 | headers = headers.set('Content-Type', httpContentTypeSelected);
|
|---|
| 306 | }
|
|---|
| 307 |
|
|---|
| 308 | return this.httpClient.post<User>(`${this.configuration.basePath}/user`,
|
|---|
| 309 | userCreation,
|
|---|
| 310 | {
|
|---|
| 311 | withCredentials: this.configuration.withCredentials,
|
|---|
| 312 | headers: headers,
|
|---|
| 313 | observe: observe,
|
|---|
| 314 | reportProgress: reportProgress
|
|---|
| 315 | }
|
|---|
| 316 | );
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | }
|
|---|