diff options
author | Ezhilarasi <ezhrajam@in.ibm.com> | 2019-04-06 00:21:57 +0530 |
---|---|---|
committer | Ezhilarasi <ezhrajam@in.ibm.com> | 2019-04-06 00:22:06 +0530 |
commit | 1b2d71d30ec8c92c50eabb2b163ec9cc9640d61a (patch) | |
tree | 582ae0edf612bc393d27fd38f8e25babac59001a /cds-ui/client/src/app/common/core | |
parent | 6e8706275241805e5fd9d2962c51a2c8f3ee3c62 (diff) |
CBA integration
Change-Id: I0505e32fe7680f1e2ee029f36d37e3ec84088789
Issue-ID: CCSDK-1068
Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
Diffstat (limited to 'cds-ui/client/src/app/common/core')
-rw-r--r-- | cds-ui/client/src/app/common/core/services/api.service.ts | 42 |
1 files changed, 32 insertions, 10 deletions
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<any> { + + 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<Blob> { + // return this._http.get<Blob>(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<Blob>(LoopbackConfig.url + uri, HTTPOptions); - get(url: string, params?: any): Observable<any> { - return this._http.get(url); } - post() { + post(uri: string, body: FormData): Observable<any> { // 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 |