2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Nokia. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 import { HttpClient } from '@angular/common/http';
22 import { Inject, Injectable } from '@angular/core';
23 import { Response } from '@angular/http';
24 import { Observable } from 'rxjs';
25 import { ISdcConfig, SdcConfigToken } from '../config/sdc-config.config';
27 // tslint:disable-next-line:interface-name
28 export interface IServerResponse {
29 data: [{ [key: string]: string }];
32 export class GabRequest {
33 constructor(public fields: string[],
34 public parentId: string,
35 public artifactUniqueId: string) {
40 // tslint:disable-next-line:max-classes-per-file
42 export class GabService {
46 constructor(@Inject(SdcConfigToken) sdcConfig: ISdcConfig, protected http: HttpClient) {
47 this.baseUrl = sdcConfig.api.root;
48 this.gabUrl = sdcConfig.api.POST_GAB_Search;
51 public getArtifact(artifactUniqueId: string, resourceId: string, columns: string[]): Observable<Response> {
52 const finalUrl: string = this.baseUrl + this.gabUrl;
53 const request: GabRequest = {
59 return this.http.post<Response>(finalUrl, request);