421 lines
19 KiB
TypeScript
421 lines
19 KiB
TypeScript
/**
|
|
* 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, HttpEvent, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
|
|
import { CustomHttpUrlEncodingCodec } from '../encoder';
|
|
|
|
import { Observable } from 'rxjs';
|
|
|
|
import { CreateUserRequest } from '../model/createUserRequest';
|
|
import { UpdateProfileRequest } from '../model/updateProfileRequest';
|
|
import { User } from '../model/user';
|
|
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();
|
|
|
|
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;
|
|
}
|
|
|
|
/**
|
|
* Add a role to users
|
|
* None
|
|
* @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: Array<string>, userId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|
public addRoleToUsers(body: Array<string>, userId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
|
public addRoleToUsers(body: Array<string>, userId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
|
public addRoleToUsers(body: Array<string>, userId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (body === null || body === undefined) {
|
|
throw new Error('Required parameter body 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;
|
|
|
|
// 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<any>('post', `${this.basePath}/user/${encodeURIComponent(String(userId))}/role`, {
|
|
body: body,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 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<User>;
|
|
public createUser(body: CreateUserRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|
public createUser(body: CreateUserRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|
public createUser(body: CreateUserRequest, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
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<User>('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 deleteUser(userId: string, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|
public deleteUser(userId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
|
public deleteUser(userId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
|
public deleteUser(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (userId === null || userId === undefined) {
|
|
throw new Error('Required parameter userId was null or undefined when calling deleteUser.');
|
|
}
|
|
|
|
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<any>('delete', `${this.basePath}/user/${encodeURIComponent(String(userId))}`, {
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Gets all the users in realm with information of roles.
|
|
* None
|
|
* @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: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<UserSearchResponse>;
|
|
public getAllUsers(
|
|
body: UserSearchRequest,
|
|
offset?: number,
|
|
limit?: number,
|
|
observe?: 'response',
|
|
reportProgress?: boolean
|
|
): Observable<HttpResponse<UserSearchResponse>>;
|
|
public getAllUsers(
|
|
body: UserSearchRequest,
|
|
offset?: number,
|
|
limit?: number,
|
|
observe?: 'events',
|
|
reportProgress?: boolean
|
|
): Observable<HttpEvent<UserSearchResponse>>;
|
|
public getAllUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (body === null || body === undefined) {
|
|
throw new Error('Required parameter body was null or undefined when calling getAllUsers.');
|
|
}
|
|
|
|
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
|
if (offset !== undefined && offset !== null) {
|
|
queryParameters = queryParameters.set('offset', <any>offset);
|
|
}
|
|
if (limit !== undefined && limit !== null) {
|
|
queryParameters = queryParameters.set('limit', <any>limit);
|
|
}
|
|
|
|
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<UserSearchResponse>('post', `${this.basePath}/user/search/red/all`, {
|
|
body: body,
|
|
params: queryParameters,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Gets the user in realm with information of 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 getUserById(userId: string, observe?: 'body', reportProgress?: boolean): Observable<User>;
|
|
public getUserById(userId: string, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<User>>;
|
|
public getUserById(userId: string, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<User>>;
|
|
public getUserById(userId: string, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (userId === null || userId === undefined) {
|
|
throw new Error('Required parameter userId was null or undefined when calling getUserById.');
|
|
}
|
|
|
|
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<User>('get', `${this.basePath}/user/${encodeURIComponent(String(userId))}`, {
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Gets the users who contain redaction roles.
|
|
* None
|
|
* @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: UserSearchRequest, offset?: number, limit?: number, observe?: 'body', reportProgress?: boolean): Observable<UserSearchResponse>;
|
|
public getUsers(
|
|
body: UserSearchRequest,
|
|
offset?: number,
|
|
limit?: number,
|
|
observe?: 'response',
|
|
reportProgress?: boolean
|
|
): Observable<HttpResponse<UserSearchResponse>>;
|
|
public getUsers(
|
|
body: UserSearchRequest,
|
|
offset?: number,
|
|
limit?: number,
|
|
observe?: 'events',
|
|
reportProgress?: boolean
|
|
): Observable<HttpEvent<UserSearchResponse>>;
|
|
public getUsers(body: UserSearchRequest, offset?: number, limit?: number, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (body === null || body === undefined) {
|
|
throw new Error('Required parameter body was null or undefined when calling getUsers.');
|
|
}
|
|
|
|
let queryParameters = new HttpParams({ encoder: new CustomHttpUrlEncodingCodec() });
|
|
if (offset !== undefined && offset !== null) {
|
|
queryParameters = queryParameters.set('offset', <any>offset);
|
|
}
|
|
if (limit !== undefined && limit !== null) {
|
|
queryParameters = queryParameters.set('limit', <any>limit);
|
|
}
|
|
|
|
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<UserSearchResponse>('post', `${this.basePath}/user/search/red`, {
|
|
body: body,
|
|
params: queryParameters,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
public updateProfile(body: UpdateProfileRequest, observe?: 'body', reportProgress?: boolean): Observable<any>;
|
|
public updateProfile(body: UpdateProfileRequest, observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<any>>;
|
|
public updateProfile(body: UpdateProfileRequest, observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<any>>;
|
|
public updateProfile(body: UpdateProfileRequest, observe: any = 'body', reportProgress: boolean = false): Observable<any> {
|
|
if (body === null || body === undefined) {
|
|
throw new Error('Required parameter body was null or undefined when calling updateProfile.');
|
|
}
|
|
|
|
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<any>('post', `${this.basePath}/user/profile`, {
|
|
body: body,
|
|
withCredentials: this.configuration.withCredentials,
|
|
headers: headers,
|
|
observe: observe,
|
|
reportProgress: reportProgress
|
|
});
|
|
}
|
|
}
|