From 52b6aa8a00f6330ff41d9c6d4d6b589fe5039c26 Mon Sep 17 00:00:00 2001 From: Cathy Hu Date: Fri, 9 Oct 2020 14:47:51 +0200 Subject: [PATCH] [frontend] Update openapi --- .../src/app/core/api/api/admin.service.ts | 111 ++++++++---------- .../app/dashboard/hoods/hoods.component.html | 2 +- 2 files changed, 50 insertions(+), 63 deletions(-) diff --git a/kibicara-frontend/src/app/core/api/api/admin.service.ts b/kibicara-frontend/src/app/core/api/api/admin.service.ts index 297bcdb..ab1b2c9 100644 --- a/kibicara-frontend/src/app/core/api/api/admin.service.ts +++ b/kibicara-frontend/src/app/core/api/api/admin.service.ts @@ -254,6 +254,55 @@ export class AdminService { ); } + /** + * Admin Read + * Get a list of all hoods of a given admin. + * @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 getAdmin(observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable; + public getAdmin(observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; + public getAdmin(observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; + public getAdmin(observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable { + + let headers = this.defaultHeaders; + + let credential: string | undefined; + // authentication (OAuth2PasswordBearer) required + credential = this.configuration.lookupCredential('OAuth2PasswordBearer'); + if (credential) { + headers = headers.set('Authorization', 'Bearer ' + credential); + } + + let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (httpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + httpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (httpHeaderAcceptSelected !== undefined) { + headers = headers.set('Accept', httpHeaderAcceptSelected); + } + + + let responseType: 'text' | 'json' = 'json'; + if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { + responseType = 'text'; + } + + return this.httpClient.get(`${this.configuration.basePath}/api/admin/`, + { + responseType: responseType, + withCredentials: this.configuration.withCredentials, + headers: headers, + observe: observe, + reportProgress: reportProgress + } + ); + } + /** * Admin Hood Read All * Get a list of all hoods of a given admin. @@ -504,66 +553,4 @@ export class AdminService { ); } - /** - * Admin Update - * @param bodyAdmin - * @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 updateAdmin(bodyAdmin: BodyAdmin, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable; - public updateAdmin(bodyAdmin: BodyAdmin, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; - public updateAdmin(bodyAdmin: BodyAdmin, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable>; - public updateAdmin(bodyAdmin: BodyAdmin, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json'}): Observable { - if (bodyAdmin === null || bodyAdmin === undefined) { - throw new Error('Required parameter bodyAdmin was null or undefined when calling updateAdmin.'); - } - - let headers = this.defaultHeaders; - - let credential: string | undefined; - // authentication (OAuth2PasswordBearer) required - credential = this.configuration.lookupCredential('OAuth2PasswordBearer'); - if (credential) { - headers = headers.set('Authorization', 'Bearer ' + credential); - } - - let httpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; - if (httpHeaderAcceptSelected === undefined) { - // to determine the Accept header - const httpHeaderAccepts: string[] = [ - 'application/json' - ]; - httpHeaderAcceptSelected = 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); - } - - let responseType: 'text' | 'json' = 'json'; - if(httpHeaderAcceptSelected && httpHeaderAcceptSelected.startsWith('text')) { - responseType = 'text'; - } - - return this.httpClient.put(`${this.configuration.basePath}/api/admin/`, - bodyAdmin, - { - responseType: responseType, - withCredentials: this.configuration.withCredentials, - headers: headers, - observe: observe, - reportProgress: reportProgress - } - ); - } - } diff --git a/kibicara-frontend/src/app/dashboard/hoods/hoods.component.html b/kibicara-frontend/src/app/dashboard/hoods/hoods.component.html index cc3d1d9..684e627 100644 --- a/kibicara-frontend/src/app/dashboard/hoods/hoods.component.html +++ b/kibicara-frontend/src/app/dashboard/hoods/hoods.component.html @@ -59,7 +59,7 @@ New hood - User settings + Account settings