From 1b2d71d30ec8c92c50eabb2b163ec9cc9640d61a Mon Sep 17 00:00:00 2001 From: Ezhilarasi Date: Sat, 6 Apr 2019 00:21:57 +0530 Subject: CBA integration Change-Id: I0505e32fe7680f1e2ee029f36d37e3ec84088789 Issue-ID: CCSDK-1068 Signed-off-by: Ezhilarasi --- .../src/app/common/core/services/api.service.ts | 42 ++++++++++++++++------ 1 file changed, 32 insertions(+), 10 deletions(-) (limited to 'cds-ui/client/src/app/common/core') diff --git a/cds-ui/client/src/app/common/core/services/api.service.ts b/cds-ui/client/src/app/common/core/services/api.service.ts index 0ee3c6a78..20d8a9bce 100644 --- a/cds-ui/client/src/app/common/core/services/api.service.ts +++ b/cds-ui/client/src/app/common/core/services/api.service.ts @@ -20,33 +20,55 @@ limitations under the License. */ + import { Injectable } from '@angular/core'; -import { HttpClient } from '@angular/common/http'; +import { HttpClient, HttpHeaders, HttpResponse, HttpHeaderResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; - -//import { IBlueprintHttp } from '../store/models/blueprint-http.model'; +import { LoopbackConfig } from '../../constants/app-constants'; @Injectable() export class ApiService { - // blueprintUrl = '../../constants/blueprint.json'; - + constructor(private _http: HttpClient) { } + enrich(uri: string, body: FormData): Observable { + + var HTTPOptions = { + headers: new HttpHeaders({ 'Accept': 'application/zip', }), + observe: "response" as 'body',// to display the full response & as 'body' for type cast + 'responseType': 'blob' as 'json' + } + return this._http.post(LoopbackConfig.url + uri, body, HTTPOptions); + + } + downloadCBA(uri: string, params?: any): Observable { + // return this._http.get(LoopbackConfig.url+uri); + var HTTPOptions = { + headers: new HttpHeaders({ 'Accept': 'application/zip; charset=UTF-8', }), + observe: "response" as 'body',// to display the full response & as 'body' for type cast + 'responseType': 'blob' as 'json' + } + return this._http.get(LoopbackConfig.url + uri, HTTPOptions); - get(url: string, params?: any): Observable { - return this._http.get(url); } - post() { + post(uri: string, body: FormData): Observable { // to do + const httpOptions = { + headers: new HttpHeaders({ + 'Authorization': LoopbackConfig.authtoken, + + }) + }; + return this._http.post(LoopbackConfig.url + uri, body, httpOptions); } put() { - // to do + // to do } delete() { - // to do + // to do } } \ No newline at end of file -- cgit 1.2.3-korg