search-mapper.ts 405 Bytes
Newer Older
Paulo's avatar
Paulo committed
1
2
3
4
5
6
7
8
9
10
11
12
import { SearchResultsFromAPI, SearchResults } from './search-result.model';

export class SearchApiMapper {

    // map API to APP
    public mapFromApi(searchResultsApi: SearchResultsFromAPI): SearchResults {
        const appModel = new SearchResults();
        appModel.fields = searchResultsApi.head.vars;
        appModel.results = searchResultsApi.results.bindings;
        return appModel;
    }
}