import { environment } from '../../environments/environment';
import { Injectable, Output, EventEmitter } from '@angular/core';
import { Http, Response } from '@angular/http';

@Injectable()
export class RepositoryService {

  constructor(private http: Http) { }

  @Output() repositorieschanged = new EventEmitter();

  getrepositorylist() {
    let endpoint = this.getendpoint('GetRepositoryList');
    return this.http.get(endpoint).map((response: Response) => response.json());
  }

  getrepository(id: string) {

  }

  updaterepository(id: string, repository) {

  }

  deleterepository(id: string) {

  }

  private getendpoint(api: string): string {
     return environment.dataendpoint + environment.dataapi + '/' + api;
  }
}
