diff --git a/libs/red-ui-http/src/lib/api/smtpConfigurationController.service.ts b/libs/red-ui-http/src/lib/api/smtpConfigurationController.service.ts new file mode 100644 index 000000000..86aef7398 --- /dev/null +++ b/libs/red-ui-http/src/lib/api/smtpConfigurationController.service.ts @@ -0,0 +1,217 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * 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 } from '@angular/common/http'; +import { CustomHttpUrlEncodingCodec } from '../encoder'; + +import { Observable } from 'rxjs'; + +import { SMTPConfigurationModel } from '../model/sMTPConfigurationModel'; + +import { BASE_PATH, COLLECTION_FORMATS } from '../variables'; +import { Configuration } from '../configuration'; + +@Injectable() +export class SmtpConfigurationControllerService { + protected basePath = ''; + public defaultHeaders = new HttpHeaders(); + public configuration = new Configuration(); + + constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { + if (basePath) { + this.basePath = basePath; + } + if (configuration) { + this.configuration = configuration; + this.basePath = basePath || configuration.basePath || this.basePath; + } + } + + /** + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise + */ + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } + } + return false; + } + + /** + * Clear SMTP Settings to KeyCloak + * + * @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 clearSMTPConfiguration(observe?: 'body', reportProgress?: boolean): Observable; + public clearSMTPConfiguration(observe?: 'response', reportProgress?: boolean): Observable>; + public clearSMTPConfiguration(observe?: 'events', reportProgress?: boolean): Observable>; + public clearSMTPConfiguration(observe: any = 'body', reportProgress: boolean = false): Observable { + 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}/configuration/smtp`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Returns the current SMTP Configuration. + * + * @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 getCurrentSMTPConfiguration(observe?: 'body', reportProgress?: boolean): Observable; + public getCurrentSMTPConfiguration(observe?: 'response', reportProgress?: boolean): Observable>; + public getCurrentSMTPConfiguration(observe?: 'events', reportProgress?: boolean): Observable>; + public getCurrentSMTPConfiguration(observe: any = 'body', reportProgress: boolean = false): Observable { + 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[] = ['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[] = []; + + return this.httpClient.request('get', `${this.basePath}/configuration/smtp`, { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Test SMTP Settings to KeyCloak + * + * @param body smtpConfigurationModel + * @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 testSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'body', reportProgress?: boolean): Observable; + public testSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'response', reportProgress?: boolean): Observable>; + public testSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'events', reportProgress?: boolean): Observable>; + public testSMTPConfiguration(body: SMTPConfigurationModel, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling testSMTPConfiguration.'); + } + + 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[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/configuration/smtp/test`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Write SMTP Settings to KeyCloak + * + * @param body smtpConfigurationModel + * @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 updateSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'body', reportProgress?: boolean): Observable; + public updateSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'response', reportProgress?: boolean): Observable>; + public updateSMTPConfiguration(body: SMTPConfigurationModel, observe?: 'events', reportProgress?: boolean): Observable>; + public updateSMTPConfiguration(body: SMTPConfigurationModel, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateSMTPConfiguration.'); + } + + 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[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/configuration/smtp`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } +} 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 81fb6e6eb..d4ce37155 100644 --- a/libs/red-ui-http/src/lib/api/userController.service.ts +++ b/libs/red-ui-http/src/lib/api/userController.service.ts @@ -16,19 +16,20 @@ import { CustomHttpUrlEncodingCodec } from '../encoder'; import { Observable } from 'rxjs'; -import { RolesRequest } from '../model/rolesRequest'; +import { CreateUserRequest } from '../model/createUserRequest'; +import { UpdateProfileRequest } from '../model/updateProfileRequest'; import { User } from '../model/user'; -import { UserRequest } from '../model/userRequest'; -import { UserResponse } from '../model/userResponse'; +import { UserSearchRequest } from '../model/userSearchRequest'; +import { UserSearchResponse } from '../model/userSearchResponse'; import { BASE_PATH } from '../variables'; import { Configuration } from '../configuration'; @Injectable() export class UserControllerService { + protected basePath = ''; public defaultHeaders = new HttpHeaders(); public configuration = new Configuration(); - protected basePath = ''; constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string, @Optional() configuration: Configuration) { if (basePath) { @@ -41,75 +42,37 @@ export class UserControllerService { } /** - * Add admin role to users - * None - * @param body rolesRequest - * @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. + * @param consumes string[] mime-types + * @return true: consumes contains 'multipart/form-data', false: otherwise */ - public addAdminRoleToUsers(body: RolesRequest, observe?: 'body', reportProgress?: boolean): Observable; - - public addAdminRoleToUsers(body: RolesRequest, observe?: 'response', reportProgress?: boolean): Observable>; - - public addAdminRoleToUsers(body: RolesRequest, observe?: 'events', reportProgress?: boolean): Observable>; - - public addAdminRoleToUsers(body: RolesRequest, observe: any = 'body', reportProgress: boolean = false): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling addAdminRoleToUsers.'); + private canConsumeForm(consumes: string[]): boolean { + const form = 'multipart/form-data'; + for (const consume of consumes) { + if (form === consume) { + return true; + } } - - 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[] = ['application/json']; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('post', `${this.basePath}/user/admin`, { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); + return false; } /** * Add a role to users * None - * @param body rolesRequest - * @param role role + * @param body roles + * @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 addRoleToUsers(body: RolesRequest, role: string, observe?: 'body', reportProgress?: boolean): Observable; - - public addRoleToUsers(body: RolesRequest, role: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public addRoleToUsers(body: RolesRequest, role: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public addRoleToUsers(body: RolesRequest, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public addRoleToUsers(body: Array, userId: string, observe?: 'body', reportProgress?: boolean): Observable; + public addRoleToUsers(body: Array, userId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public addRoleToUsers(body: Array, userId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public addRoleToUsers(body: Array, userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling addRoleToUsers.'); } - if (role === null || role === undefined) { - throw new Error('Required parameter role was null or undefined when calling addRoleToUsers.'); + if (userId === null || userId === undefined) { + throw new Error('Required parameter userId was null or undefined when calling addRoleToUsers.'); } let headers = this.defaultHeaders; @@ -134,7 +97,7 @@ export class UserControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/user/role/${encodeURIComponent(String(role))}`, { + return this.httpClient.request('post', `${this.basePath}/user/${encodeURIComponent(String(userId))}/role`, { body: body, withCredentials: this.configuration.withCredentials, headers: headers, @@ -144,21 +107,64 @@ export class UserControllerService { } /** - * Delete admin role from user + * Create a new user. + * None + * @param body 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 createUser(body: CreateUserRequest, observe?: 'body', reportProgress?: boolean): Observable; + public createUser(body: CreateUserRequest, observe?: 'response', reportProgress?: boolean): Observable>; + public createUser(body: CreateUserRequest, observe?: 'events', reportProgress?: boolean): Observable>; + public createUser(body: CreateUserRequest, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling createUser.'); + } + + 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[] = ['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.request('post', `${this.basePath}/user`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); + } + + /** + * Gets the users who contain redaction roles. * 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 deleteAdminRoleFromUser(userId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteAdminRoleFromUser(userId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUser(userId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUser(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + public deleteUser(userId: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteUser(userId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteUser(userId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteUser(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (userId === null || userId === undefined) { - throw new Error('Required parameter userId was null or undefined when calling deleteAdminRoleFromUser.'); + throw new Error('Required parameter userId was null or undefined when calling deleteUser.'); } let headers = this.defaultHeaders; @@ -179,159 +185,7 @@ export class UserControllerService { // to determine the Content-Type header const consumes: string[] = []; - return this.httpClient.request('delete', `${this.basePath}/user/admin/${encodeURIComponent(String(userId))}`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); - } - - /** - * Delete admin role from users - * None - * @param body rolesRequest - * @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 deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUsers(body: RolesRequest, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteAdminRoleFromUsers(body: RolesRequest, observe: any = 'body', reportProgress: boolean = false): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteAdminRoleFromUsers.'); - } - - 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[] = ['application/json']; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('put', `${this.basePath}/user/admin`, { - body: body, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); - } - - /** - * Delete a role from user - * None - * @param role role - * @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 deleteRoleFromUser(role: string, userId: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteRoleFromUser(role: string, userId: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteRoleFromUser(role: string, userId: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteRoleFromUser(role: string, userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { - if (role === null || role === undefined) { - throw new Error('Required parameter role was null or undefined when calling deleteRoleFromUser.'); - } - - if (userId === null || userId === undefined) { - throw new Error('Required parameter userId was null or undefined when calling deleteRoleFromUser.'); - } - - 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/role/${encodeURIComponent(String(role))}/${encodeURIComponent(String(userId))}`, { - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - }); - } - - /** - * Delete a role from users - * None - * @param body rolesRequest - * @param role role - * @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 deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'body', reportProgress?: boolean): Observable; - - public deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'response', reportProgress?: boolean): Observable>; - - public deleteRoleFromUsers(body: RolesRequest, role: string, observe?: 'events', reportProgress?: boolean): Observable>; - - public deleteRoleFromUsers(body: RolesRequest, role: string, observe: any = 'body', reportProgress: boolean = false): Observable { - if (body === null || body === undefined) { - throw new Error('Required parameter body was null or undefined when calling deleteRoleFromUsers.'); - } - - if (role === null || role === undefined) { - throw new Error('Required parameter role was null or undefined when calling deleteRoleFromUsers.'); - } - - 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[] = ['application/json']; - const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); - if (httpContentTypeSelected !== undefined) { - headers = headers.set('Content-Type', httpContentTypeSelected); - } - - return this.httpClient.request('post', `${this.basePath}/user/role/delete/${encodeURIComponent(String(role))}`, { - body: body, + return this.httpClient.request('delete', `${this.basePath}/user/${encodeURIComponent(String(userId))}`, { withCredentials: this.configuration.withCredentials, headers: headers, observe: observe, @@ -342,25 +196,28 @@ export class UserControllerService { /** * Gets all the users in realm with information of roles. * None - * @param body userRequest + * @param body userSearchRequest * @param offset offset * @param limit limit * @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 getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - + public getAllUsers(body: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; public getAllUsers( - body: UserRequest, + body: UserSearchRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean - ): Observable>; - - public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - - public getAllUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { + ): Observable>; + public getAllUsers( + body: UserSearchRequest, + offset?: number, + limit?: number, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public getAllUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling getAllUsers.'); } @@ -395,7 +252,7 @@ export class UserControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/user/all`, { + return this.httpClient.request('post', `${this.basePath}/user/search/red/all`, { body: body, params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -413,11 +270,8 @@ export class UserControllerService { * @param reportProgress flag to report request and response progress. */ public getUserById(userId: string, observe?: 'body', reportProgress?: boolean): Observable; - public getUserById(userId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public getUserById(userId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getUserById(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (userId === null || userId === undefined) { throw new Error('Required parameter userId was null or undefined when calling getUserById.'); @@ -452,19 +306,28 @@ export class UserControllerService { /** * Gets the users who contain redaction roles. * None - * @param body userRequest + * @param body userSearchRequest * @param offset offset * @param limit limit * @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 getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'response', reportProgress?: boolean): Observable>; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe?: 'events', reportProgress?: boolean): Observable>; - - public getUsers(body: UserRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { + public getUsers(body: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable; + public getUsers( + body: UserSearchRequest, + offset?: number, + limit?: number, + observe?: 'response', + reportProgress?: boolean + ): Observable>; + public getUsers( + body: UserSearchRequest, + offset?: number, + limit?: number, + observe?: 'events', + reportProgress?: boolean + ): Observable>; + public getUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { throw new Error('Required parameter body was null or undefined when calling getUsers.'); } @@ -499,7 +362,7 @@ export class UserControllerService { headers = headers.set('Content-Type', httpContentTypeSelected); } - return this.httpClient.request('post', `${this.basePath}/user`, { + return this.httpClient.request('post', `${this.basePath}/user/search/red`, { body: body, params: queryParameters, withCredentials: this.configuration.withCredentials, @@ -510,16 +373,48 @@ export class UserControllerService { } /** - * @param consumes string[] mime-types - * @return true: consumes contains 'multipart/form-data', false: otherwise + * Update your own user-profile. + * None + * @param body updateProfileRequest + * @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. */ - private canConsumeForm(consumes: string[]): boolean { - const form = 'multipart/form-data'; - for (const consume of consumes) { - if (form === consume) { - return true; - } + public updateProfile(body: UpdateProfileRequest, observe?: 'body', reportProgress?: boolean): Observable; + public updateProfile(body: UpdateProfileRequest, observe?: 'response', reportProgress?: boolean): Observable>; + public updateProfile(body: UpdateProfileRequest, observe?: 'events', reportProgress?: boolean): Observable>; + public updateProfile(body: UpdateProfileRequest, observe: any = 'body', reportProgress: boolean = false): Observable { + if (body === null || body === undefined) { + throw new Error('Required parameter body was null or undefined when calling updateProfile.'); } - return false; + + 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[] = ['application/json']; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('post', `${this.basePath}/user/profile`, { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + }); } } diff --git a/libs/red-ui-http/src/lib/model/createUserRequest.ts b/libs/red-ui-http/src/lib/model/createUserRequest.ts new file mode 100644 index 000000000..43cf02da2 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/createUserRequest.ts @@ -0,0 +1,30 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface CreateUserRequest { + /** + * Email of user. + */ + email?: string; + /** + * First name of user. + */ + firstName?: string; + /** + * Last name of user. + */ + lastName?: string; + /** + * The list of RED_* roles. + */ + roles?: Array; +} diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index bb7bbc6e3..cf8fd8aa0 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -66,4 +66,7 @@ export * from './importCsvResponse'; export * from './fileAttributeConfig'; export * from './fileAttributesBaseConfigRequest'; export * from './removeDownloadRequest'; -export * from './smtpConfigurationModel'; +export * from './sMTPConfigurationModel'; +export * from './userSearchRequest'; +export * from './userSearchResponse'; +export * from './updateProfileRequest'; diff --git a/libs/red-ui-http/src/lib/model/smtpConfigurationModel.ts b/libs/red-ui-http/src/lib/model/sMTPConfigurationModel.ts similarity index 52% rename from libs/red-ui-http/src/lib/model/smtpConfigurationModel.ts rename to libs/red-ui-http/src/lib/model/sMTPConfigurationModel.ts index d91a992fe..f9125a02c 100644 --- a/libs/red-ui-http/src/lib/model/smtpConfigurationModel.ts +++ b/libs/red-ui-http/src/lib/model/sMTPConfigurationModel.ts @@ -1,16 +1,26 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + export interface SMTPConfigurationModel { + auth?: boolean; + envelopeFrom?: string; from?: string; fromDisplayName?: string; - envelopeFrom?: string; host?: string; + password?: string; port?: number; replyTo?: string; replyToDisplayName?: string; ssl?: boolean; starttls?: boolean; - - // if AUTH is true, following must also be set - auth?: boolean; user?: string; - password?: string; } diff --git a/libs/red-ui-http/src/lib/model/updateProfileRequest.ts b/libs/red-ui-http/src/lib/model/updateProfileRequest.ts new file mode 100644 index 000000000..7d6e6bd94 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/updateProfileRequest.ts @@ -0,0 +1,26 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface UpdateProfileRequest { + /** + * Email of user. + */ + email?: string; + /** + * First name of user. + */ + firstName?: string; + /** + * Last name of user. + */ + lastName?: string; +} diff --git a/libs/red-ui-http/src/lib/model/userSearchRequest.ts b/libs/red-ui-http/src/lib/model/userSearchRequest.ts new file mode 100644 index 000000000..731656408 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/userSearchRequest.ts @@ -0,0 +1,16 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +export interface UserSearchRequest { + search?: string; + requestId?: string; +} diff --git a/libs/red-ui-http/src/lib/model/userSearchResponse.ts b/libs/red-ui-http/src/lib/model/userSearchResponse.ts new file mode 100644 index 000000000..c3cd062d9 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/userSearchResponse.ts @@ -0,0 +1,34 @@ +/** + * API Documentation for Redaction Gateway + * Description for redaction + * + * OpenAPI spec version: 1.0 + * + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ +import { User } from './user'; + +/** + * Object containing a list of values of user. + */ +export interface UserSearchResponse { + /** + * True if there is next page. + */ + hasNextPage?: boolean; + /** + * The requestId generated by server. + */ + requestId?: string; + /** + * Total number of available users. + */ + total?: number; + /** + * The list of user, which includes all the important information about a user. + */ + users?: Array; +}