import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { GetRepositoryStatisticsPayload } from '@pimp-my-pr/pmp-web/repository/domain' ; import { IResponse , RepositoryStatistics } from '@pimp-my-pr/shared/domain' ; import { urlFactory } from '@valueadd/typed-urls' ; import { Observable } from 'rxjs' ; import { map } from 'rxjs/operators' ; @ Injectable ( ) export class RepositoryStatisticsDataService { readonly endpoints = { getRepositoryStatistics : urlFactory < 'repositoryId' > ( '/api/statistics/repository/:repositoryId' , true ) } ; constructor ( private http ) { } getRepositoryStatistics ( payload ) { return this . http . get < IResponse < RepositoryStatistics , null > > ( this . endpoints . getRepositoryStatistics . url ( { repositoryId : payload . id } ) ) . pipe ( map ( ( res ) => res . data ) ) ; } }