diff --git a/README.md b/README.md index 05f75d236..29ba488fb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Swagger Generated Code To regnerate http rune swaagger ``` -URL=http://ingress.redaction-timo-dev-0304.178.63.47.73.xip.io/v2/api-docs?group=redaction-gateway-v1 +URL=https://timo-redaction-dev.iqser.cloud/v2/api-docs?group=redaction-gateway-v1 mkdir -p /tmp/swagger swagger-codegen generate -i "$URL" -l typescript-angular -o /tmp/swagger ``` diff --git a/libs/red-ui-http/src/lib/api/projectController.service.ts b/libs/red-ui-http/src/lib/api/projectController.service.ts index 73da3acf6..2c36d650a 100644 --- a/libs/red-ui-http/src/lib/api/projectController.service.ts +++ b/libs/red-ui-http/src/lib/api/projectController.service.ts @@ -16,6 +16,7 @@ import {HttpClient, HttpEvent, HttpHeaders, HttpResponse} from '@angular/common/ import {Observable} from 'rxjs'; import {Project} from '../model/project'; +import {ProjectMembers} from '../model/projectMembers'; import {ProjectRequest} from '../model/projectRequest'; import {BASE_PATH} from '../variables'; @@ -25,9 +26,9 @@ import {Configuration} from '../configuration'; @Injectable() export class ProjectControllerService { + 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) { @@ -39,6 +40,130 @@ export class ProjectControllerService { } } + /** + * @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; + } + + + /** + * Adds members to project. + * None + * @param body projectMembers + * @param projectId projectId + * @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 addMembersToProject(body: ProjectMembers, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + public addMembersToProject(body: ProjectMembers, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public addMembersToProject(body: ProjectMembers, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public addMembersToProject(body: ProjectMembers, projectId: 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 addMembersToProject.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling addMembersToProject.'); + } + + 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}/project/members/${encodeURIComponent(String(projectId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + + /** + * Assigns new owner to project. + * None + * @param projectId projectId + * @param ownerId ownerId + * @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 assignProjectOwner(projectId: string, ownerId: string, observe?: 'body', reportProgress?: boolean): Observable; + public assignProjectOwner(projectId: string, ownerId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public assignProjectOwner(projectId: string, ownerId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public assignProjectOwner(projectId: string, ownerId: string, observe: any = 'body', reportProgress: boolean = false): Observable { + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling assignProjectOwner.'); + } + + if (ownerId === null || ownerId === undefined) { + throw new Error('Required parameter ownerId was null or undefined when calling assignProjectOwner.'); + } + + 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('post', `${this.basePath}/project/${encodeURIComponent(String(projectId))}/${encodeURIComponent(String(ownerId))}`, + { + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Creates a new project. * None @@ -47,11 +172,8 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public createProject(body: ProjectRequest, observe?: 'body', reportProgress?: boolean): Observable; - public createProject(body: ProjectRequest, observe?: 'response', reportProgress?: boolean): Observable>; - public createProject(body: ProjectRequest, observe?: 'events', reportProgress?: boolean): Observable>; - public createProject(body: ProjectRequest, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { @@ -97,6 +219,64 @@ export class ProjectControllerService { ); } + /** + * Deletes members from project. + * None + * @param body projectMembers + * @param projectId projectId + * @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 deleteMembersToProject(body: ProjectMembers, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; + public deleteMembersToProject(body: ProjectMembers, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; + public deleteMembersToProject(body: ProjectMembers, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; + public deleteMembersToProject(body: ProjectMembers, projectId: 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 deleteMembersToProject.'); + } + + if (projectId === null || projectId === undefined) { + throw new Error('Required parameter projectId was null or undefined when calling deleteMembersToProject.'); + } + + 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[] = [ + '*/*' + ]; + const httpContentTypeSelected: string | undefined = this.configuration.selectHeaderContentType(consumes); + if (httpContentTypeSelected !== undefined) { + headers = headers.set('Content-Type', httpContentTypeSelected); + } + + return this.httpClient.request('delete', `${this.basePath}/project/members/${encodeURIComponent(String(projectId))}`, + { + body: body, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Deletes an existing project. * None @@ -105,11 +285,8 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public deleteProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public deleteProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public deleteProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public deleteProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { @@ -154,11 +331,8 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public getProject(projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public getProject(projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public getProject(projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public getProject(projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (projectId === null || projectId === undefined) { @@ -204,11 +378,8 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public getProjects(observe?: 'body', reportProgress?: boolean): Observable>; - public getProjects(observe?: 'response', reportProgress?: boolean): Observable>>; - public getProjects(observe?: 'events', reportProgress?: boolean): Observable>>; - public getProjects(observe: any = 'body', reportProgress: boolean = false): Observable { let headers = this.defaultHeaders; @@ -252,11 +423,8 @@ export class ProjectControllerService { * @param reportProgress flag to report request and response progress. */ public updateProject(body: ProjectRequest, projectId: string, observe?: 'body', reportProgress?: boolean): Observable; - public updateProject(body: ProjectRequest, projectId: string, observe?: 'response', reportProgress?: boolean): Observable>; - public updateProject(body: ProjectRequest, projectId: string, observe?: 'events', reportProgress?: boolean): Observable>; - public updateProject(body: ProjectRequest, projectId: string, observe: any = 'body', reportProgress: boolean = false): Observable { if (body === null || body === undefined) { @@ -306,18 +474,4 @@ export class ProjectControllerService { ); } - /** - * @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; - } - } diff --git a/libs/red-ui-http/src/lib/model/models.ts b/libs/red-ui-http/src/lib/model/models.ts index 50a168016..6ed52ee24 100644 --- a/libs/red-ui-http/src/lib/model/models.ts +++ b/libs/red-ui-http/src/lib/model/models.ts @@ -31,3 +31,4 @@ export * from './updateTypeValue'; export * from './user'; export * from './userRequest'; export * from './userResponse'; +export * from './projectMembers'; diff --git a/libs/red-ui-http/src/lib/model/projectMembers.ts b/libs/red-ui-http/src/lib/model/projectMembers.ts new file mode 100644 index 000000000..4d4e5b376 --- /dev/null +++ b/libs/red-ui-http/src/lib/model/projectMembers.ts @@ -0,0 +1,15 @@ +/** + * 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 ProjectMembers { + memberIds?: Array; +} \ No newline at end of file diff --git a/libs/red-ui-http/src/lib/model/projectRequest.ts b/libs/red-ui-http/src/lib/model/projectRequest.ts index 66d2db734..efae8d80b 100644 --- a/libs/red-ui-http/src/lib/model/projectRequest.ts +++ b/libs/red-ui-http/src/lib/model/projectRequest.ts @@ -3,14 +3,14 @@ * 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 ProjectRequest { - projectName?: string; - description?: string; -} +export interface ProjectRequest { + projectName?: string; + description?: string; +} \ No newline at end of file