| 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<Array<string>>;
|
|---|
| 144 | public usersApiKeyCreate(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<string>>>;
|
|---|
| 145 | public usersApiKeyCreate(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<string>>>;
|
|---|
| 146 | public usersApiKeyCreate(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 147 |
|
|---|
| 148 | let headers = this.defaultHeaders;
|
|---|
| 149 |
|
|---|
| 150 | // authentication (basicAuth) required
|
|---|
| 151 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 152 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 153 | }
|
|---|
| 154 | // to determine the Accept header
|
|---|
| 155 | const httpHeaderAccepts: string[] = [
|
|---|
| 156 | 'application/json'
|
|---|
| 157 | ];
|
|---|
| 158 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 159 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 160 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 | // to determine the Content-Type header
|
|---|
| 164 | const consumes: string[] = [
|
|---|
| 165 | ];
|
|---|
| 166 |
|
|---|
| 167 | return this.httpClient.get<Array<string>>(`${this.configuration.basePath}/user/apikey_create`,
|
|---|
| 168 | {
|
|---|
| 169 | withCredentials: this.configuration.withCredentials,
|
|---|
| 170 | headers: headers,
|
|---|
| 171 | observe: observe,
|
|---|
| 172 | reportProgress: reportProgress
|
|---|
| 173 | }
|
|---|
| 174 | );
|
|---|
| 175 | }
|
|---|
| 176 |
|
|---|
| 177 | /**
|
|---|
| 178 | * Deletes API key
|
|---|
| 179 | * Deletes given API key and returns remaining API keys of the user
|
|---|
| 180 | * @param apiKey API key
|
|---|
| 181 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 182 | * @param reportProgress flag to report request and response progress.
|
|---|
| 183 | */
|
|---|
| 184 | public usersApiKeyDelete(apiKey: string, observe?: 'body', reportProgress?: boolean): Observable<Array<string>>;
|
|---|
| 185 | public usersApiKeyDelete(apiKey: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<Array<string>>>;
|
|---|
| 186 | public usersApiKeyDelete(apiKey: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<Array<string>>>;
|
|---|
| 187 | public usersApiKeyDelete(apiKey: string, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 188 | if (apiKey === null || apiKey === undefined) {
|
|---|
| 189 | throw new Error('Required parameter apiKey was null or undefined when calling usersApiKeyDelete.');
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | let headers = this.defaultHeaders;
|
|---|
| 193 |
|
|---|
| 194 | // authentication (basicAuth) required
|
|---|
| 195 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 196 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 197 | }
|
|---|
| 198 | // to determine the Accept header
|
|---|
| 199 | const httpHeaderAccepts: string[] = [
|
|---|
| 200 | 'application/json'
|
|---|
| 201 | ];
|
|---|
| 202 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 203 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 204 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 205 | }
|
|---|
| 206 |
|
|---|
| 207 | // to determine the Content-Type header
|
|---|
| 208 | const consumes: string[] = [
|
|---|
| 209 | ];
|
|---|
| 210 |
|
|---|
| 211 | return this.httpClient.delete<Array<string>>(`${this.configuration.basePath}/user/${encodeURIComponent(String(apiKey))}`,
|
|---|
| 212 | {
|
|---|
| 213 | withCredentials: this.configuration.withCredentials,
|
|---|
| 214 | headers: headers,
|
|---|
| 215 | observe: observe,
|
|---|
| 216 | reportProgress: reportProgress
|
|---|
| 217 | }
|
|---|
| 218 | );
|
|---|
| 219 | }
|
|---|
| 220 |
|
|---|
| 221 | /**
|
|---|
| 222 | * Returns info of a user
|
|---|
| 223 | * Returns information of current/authorized user
|
|---|
| 224 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 225 | * @param reportProgress flag to report request and response progress.
|
|---|
| 226 | */
|
|---|
| 227 | public usersGet(observe?: 'body', reportProgress?: boolean): Observable<User>;
|
|---|
| 228 | public usersGet(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|---|
| 229 | public usersGet(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|---|
| 230 | public usersGet(observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 231 |
|
|---|
| 232 | let headers = this.defaultHeaders;
|
|---|
| 233 |
|
|---|
| 234 | // authentication (apiKeyAuth) required
|
|---|
| 235 | if (this.configuration.apiKeys && this.configuration.apiKeys["X-API-KEY"]) {
|
|---|
| 236 | headers = headers.set('X-API-KEY', this.configuration.apiKeys["X-API-KEY"]);
|
|---|
| 237 | }
|
|---|
| 238 |
|
|---|
| 239 | // authentication (basicAuth) required
|
|---|
| 240 | if (this.configuration.username || this.configuration.password) {
|
|---|
| 241 | headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password));
|
|---|
| 242 | }
|
|---|
| 243 | // to determine the Accept header
|
|---|
| 244 | const httpHeaderAccepts: string[] = [
|
|---|
| 245 | 'application/json'
|
|---|
| 246 | ];
|
|---|
| 247 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 248 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 249 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 250 | }
|
|---|
| 251 |
|
|---|
| 252 | // to determine the Content-Type header
|
|---|
| 253 | const consumes: string[] = [
|
|---|
| 254 | ];
|
|---|
| 255 |
|
|---|
| 256 | return this.httpClient.get<User>(`${this.configuration.basePath}/user`,
|
|---|
| 257 | {
|
|---|
| 258 | withCredentials: this.configuration.withCredentials,
|
|---|
| 259 | headers: headers,
|
|---|
| 260 | observe: observe,
|
|---|
| 261 | reportProgress: reportProgress
|
|---|
| 262 | }
|
|---|
| 263 | );
|
|---|
| 264 | }
|
|---|
| 265 |
|
|---|
| 266 | /**
|
|---|
| 267 | * Registers a new user
|
|---|
| 268 | * Registers a new user
|
|---|
| 269 | * @param userCreation
|
|---|
| 270 | * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
|
|---|
| 271 | * @param reportProgress flag to report request and response progress.
|
|---|
| 272 | */
|
|---|
| 273 | public usersRegister(userCreation?: UserCreation, observe?: 'body', reportProgress?: boolean): Observable<User>;
|
|---|
| 274 | public usersRegister(userCreation?: UserCreation, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|---|
| 275 | public usersRegister(userCreation?: UserCreation, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|---|
| 276 | public usersRegister(userCreation?: UserCreation, observe: any = 'body', reportProgress: boolean = false ): Observable<any> {
|
|---|
| 277 |
|
|---|
| 278 | let headers = this.defaultHeaders;
|
|---|
| 279 |
|
|---|
| 280 | // to determine the Accept header
|
|---|
| 281 | const httpHeaderAccepts: string[] = [
|
|---|
| 282 | 'application/json'
|
|---|
| 283 | ];
|
|---|
| 284 | const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
|
|---|
| 285 | if (httpHeaderAcceptSelected !== undefined) {
|
|---|
| 286 | headers = headers.set('Accept', httpHeaderAcceptSelected);
|
|---|
| 287 | }
|
|---|
| 288 |
|
|---|
| 289 | // to determine the Content-Type header
|
|---|
| 290 | const consumes: string[] = [
|
|---|
| 291 | 'application/json'
|
|---|
| 292 | ];
|
|---|
| 293 | const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes);
|
|---|
| 294 | if (httpContentTypeSelected !== undefined) {
|
|---|
| 295 | headers = headers.set('Content-Type', httpContentTypeSelected);
|
|---|
| 296 | }
|
|---|
| 297 |
|
|---|
| 298 | return this.httpClient.post<User>(`${this.configuration.basePath}/user`,
|
|---|
| 299 | userCreation,
|
|---|
| 300 | {
|
|---|
| 301 | withCredentials: this.configuration.withCredentials,
|
|---|
| 302 | headers: headers,
|
|---|
| 303 | observe: observe,
|
|---|
| 304 | reportProgress: reportProgress
|
|---|
| 305 | }
|
|---|
| 306 | );
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | }
|
|---|