import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { environment } from '../../../environments/environment';
import { HttpClient } from '@angular/common/http';
import { map } from 'rxjs/internal/operators';
import { StringHelper } from '../../helpers/string-helper';

@Injectable()
export class MetadataService {

  constructor(private http: HttpClient) {
  }

  public getMetadata(metadataName: string): Observable<any[]> {
    const qstring = environment.api + '/metadata/' + metadataName;
    return this.http.get(qstring)
      .pipe(map((response: any) => {
        return response as any[];
      }));
  }
}
