From 2875f609360bd6ea9f2a87fce54bc71ad0cafa6a Mon Sep 17 00:00:00 2001 From: Timo Date: Wed, 7 Apr 2021 15:18:40 +0300 Subject: [PATCH] user service updates --- .../src/lib/api/userController.service.ts | 51 ++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/libs/red-ui-http/src/lib/api/userController.service.ts b/libs/red-ui-http/src/lib/api/userController.service.ts index ddbde3e1b..ccf626223 100644 --- a/libs/red-ui-http/src/lib/api/userController.service.ts +++ b/libs/red-ui-http/src/lib/api/userController.service.ts @@ -154,7 +154,7 @@ export class UserControllerService { } /** - * Gets the users who contain redaction roles. + * Deletes given user * None * @param userId userId * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. @@ -194,6 +194,55 @@ export class UserControllerService { }); } + /** + * Deletes given users + * None + * @param userId userId + * @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 deleteUsers(userId: Array, observe?: 'body', reportProgress?: boolean): Observable; + public deleteUsers(userId: Array, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteUsers(userId: Array, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteUsers(userId: Array, observe: any = 'body', reportProgress: boolean = false): Observable { + if (userId === null || userId === undefined) { + throw new Error('Required parameter userId was null or undefined when calling deleteUser1.'); + } + + let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() }); + if (userId) { + userId.forEach((element) => { + queryParameters = queryParameters.append('userId', element); + }); + } + + let headers = this.defaultHeaders; + + // authentication (RED-OAUTH) required + if (this.configuration.accessToken) { + const accessToken = typeof this.configuration.accessToken === 'function' ? this.configuration.accessToken() : this.configuration.accessToken; + headers = headers.set('Authorization', 'Bearer ' + accessToken); + } + + // to determine the Accept header + const httpHeaderAccepts: string[] = []; + 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[] = []; + + return this.httpClient.request('delete', `${this.basePath}/user`, { + params: queryParameters, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + /** * Gets all the users in realm with information of roles. * None