/** * Gravitee.io Portal Rest API * API dedicated to the devportal part of Gravitee * * The version of the OpenAPI document: 3.0.0 * Contact: contact@graviteesource.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams, HttpResponse, HttpEvent, HttpParameterCodec } from '@angular/common/http'; import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; import { ErrorResponse } from '../model/errorResponse'; import { PortalNotificationsResponse } from '../model/portalNotificationsResponse'; import { User } from '../model/user'; import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; import { Configuration } from '../configuration'; export interface DeleteCurrentUserNotificationByNotificationIdRequestParams { notificationId: string; } export interface GetCurrentUserNotificationsRequestParams { page?: number; size?: number; } export interface UpdateCurrentUserRequestParams { User?: User; } @Injectable({ providedIn: 'root' }) export class UserService { protected basePath = 'http://demo.gravitee.io/portal/DEFAULT'; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); public encoder: HttpParameterCodec; constructor(protected httpClient: HttpClient, @Optional()@Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (configuration) { this.configuration = configuration; } if (typeof this.configuration.basePath !== 'string') { if (typeof basePath !== 'string') { basePath = this.basePath; } this.configuration.basePath = basePath; } this.encoder = this.configuration.encoder || new CustomHttpParameterCodec(); } /** * Delete all notifications of the current user * Delete all notifications of the current user. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public deleteAllCurrentUserNotifications(observe?: 'body', reportProgress?: boolean): Observable; public deleteAllCurrentUserNotifications(observe?: 'response', reportProgress?: boolean): Observable>; public deleteAllCurrentUserNotifications(observe?: 'events', reportProgress?: boolean): Observable>; public deleteAllCurrentUserNotifications(observe: any = 'body', reportProgress: boolean = false ): Observable { let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.delete(`${this.configuration.basePath}/user/notifications`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Delete a specific notification of the current user * Delete a specific notification of the current user. * @param requestParameters * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public deleteCurrentUserNotificationByNotificationId(requestParameters: DeleteCurrentUserNotificationByNotificationIdRequestParams, observe?: 'body', reportProgress?: boolean): Observable; public deleteCurrentUserNotificationByNotificationId(requestParameters: DeleteCurrentUserNotificationByNotificationIdRequestParams, observe?: 'response', reportProgress?: boolean): Observable>; public deleteCurrentUserNotificationByNotificationId(requestParameters: DeleteCurrentUserNotificationByNotificationIdRequestParams, observe?: 'events', reportProgress?: boolean): Observable>; public deleteCurrentUserNotificationByNotificationId(requestParameters: DeleteCurrentUserNotificationByNotificationIdRequestParams, observe: any = 'body', reportProgress: boolean = false ): Observable { const notificationId = requestParameters.notificationId; if (notificationId === null || notificationId === undefined) { throw new Error('Required parameter notificationId was null or undefined when calling deleteCurrentUserNotificationByNotificationId.'); } let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.delete(`${this.configuration.basePath}/user/notifications/${encodeURIComponent(String(notificationId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Get the authenticated user * Get information about the authenticated user. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public getCurrentUser(observe?: 'body', reportProgress?: boolean): Observable; public getCurrentUser(observe?: 'response', reportProgress?: boolean): Observable>; public getCurrentUser(observe?: 'events', reportProgress?: boolean): Observable>; public getCurrentUser(observe: any = 'body', reportProgress: boolean = false ): Observable { let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.get(`${this.configuration.basePath}/user`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Retrieve user\'s avatar * Retrieve user\'s avatar. * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public getCurrentUserAvatar(observe?: 'body', reportProgress?: boolean): Observable; public getCurrentUserAvatar(observe?: 'response', reportProgress?: boolean): Observable>; public getCurrentUserAvatar(observe?: 'events', reportProgress?: boolean): Observable>; public getCurrentUserAvatar(observe: any = 'body', reportProgress: boolean = false ): Observable { let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'image/_*', 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.get(`${this.configuration.basePath}/user/avatar`, { responseType: "blob", withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Retrieve user\'s notifications * Retrieve current user\'s notifications. * @param requestParameters * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public getCurrentUserNotifications(requestParameters: GetCurrentUserNotificationsRequestParams, observe?: 'body', reportProgress?: boolean): Observable; public getCurrentUserNotifications(requestParameters: GetCurrentUserNotificationsRequestParams, observe?: 'response', reportProgress?: boolean): Observable>; public getCurrentUserNotifications(requestParameters: GetCurrentUserNotificationsRequestParams, observe?: 'events', reportProgress?: boolean): Observable>; public getCurrentUserNotifications(requestParameters: GetCurrentUserNotificationsRequestParams, observe: any = 'body', reportProgress: boolean = false ): Observable { const page = requestParameters.page; const size = requestParameters.size; let queryParameters = new HttpParams({encoder: this.encoder}); if (page !== undefined && page !== null) { queryParameters = queryParameters.set('page', page); } if (size !== undefined && size !== null) { queryParameters = queryParameters.set('size', size); } let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } return this.httpClient.get(`${this.configuration.basePath}/user/notifications`, { params: queryParameters, withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } /** * Modify current user information. * Modify current user information. Only the current user can modify his/her information. * @param requestParameters * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public updateCurrentUser(requestParameters: UpdateCurrentUserRequestParams, observe?: 'body', reportProgress?: boolean): Observable; public updateCurrentUser(requestParameters: UpdateCurrentUserRequestParams, observe?: 'response', reportProgress?: boolean): Observable>; public updateCurrentUser(requestParameters: UpdateCurrentUserRequestParams, observe?: 'events', reportProgress?: boolean): Observable>; public updateCurrentUser(requestParameters: UpdateCurrentUserRequestParams, observe: any = 'body', reportProgress: boolean = false ): Observable { const User = requestParameters.User; let headers = this.defaultHeaders; // authentication (BasicAuth) required if (this.configuration.username || this.configuration.password) { headers = headers.set('Authorization', 'Basic ' + btoa(this.configuration.username + ':' + this.configuration.password)); } // authentication (CookieAuth) required // to determine the Accept header const httpHeaderAccepts: string[] = [ 'application/json' ]; const httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts); if (httpHeaderAcceptSelected !== undefined) { headers = headers.set('Accept', httpHeaderAcceptSelected); } // to determine the Content-Type header const consumes: string[] = [ 'application/json' ]; const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); if (httpContentTypeSelected !== undefined) { headers = headers.set('Content-Type', httpContentTypeSelected); } return this.httpClient.put(`${this.configuration.basePath}/user`, User, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, reportProgress: reportProgress } ); } }