<commit_before>import { Injectable }   from '@angular/core';
import { Http, Headers }         from '@angular/http';
import {Platform, ionicBootstrap, Storage, SqlStorage} from 'ionic-angular';
import 'rxjs/add/operator/toPromise';
import {AppSettings} from '../config/app.settings';

@Injectable()
export class OmarksAlgoliaService {

    public index: string;
    public application_id: string;
    public api_key: string;

    private service_url: string;
    private headers: Headers;

    constructor(private http: Http, private settings: AppSettings) { 

        this.index = settings.getIndex();
        this.application_id = settings.getApplicationId();
        this.api_key = settings.getApiKey();

        this.service_url = 'https://' + this.application_id + '.algolia.net/1/indexes/' + this.index;

        this.headers = new Headers({
            'Content-Type': 'application/json',
            'Accept': 'application/JSON',
            'X-Algolia-API-Key': this.api_key,
            'X-Algolia-Application-Id': 'M90FC3UY18'
        });
    }

    private handleError(error: any): Promise<any> {
        console.log('An error occurred', error);
        return Promise.reject(error.message || error);
    }

    public get_dashboard() : Promise<any> {
        
        return this.http.get(this.service_url, {headers: this.headers})
               .toPromise()<commit_msg>#9 Dashboard query<commit_after>import { Injectable }   from '@angular/core';
import { Http, Headers }         from '@angular/http';
import {Platform, ionicBootstrap, Storage, SqlStorage} from 'ionic-angular';
import 'rxjs/add/operator/toPromise';
import {AppSettings} from '../config/app.settings';

@Injectable()
export class OmarksAlgoliaService {

    public index: string;
    public application_id: string;
    public api_key: string;

    private service_url: string;
    private headers: Headers;

    constructor(private http: Http, private settings: AppSettings) { 

        this.index = settings.getIndex();
        this.application_id = settings.getApplicationId();
        this.api_key = settings.getApiKey();

        this.service_url = 'https://' + this.application_id + '.algolia.net/1/indexes/' + this.index;

        this.headers = new Headers({
            'Content-Type': 'application/json',
            'Accept': 'application/JSON',
            'X-Algolia-API-Key': this.api_key,
            'X-Algolia-Application-Id': 'M90FC3UY18'
        });
    }

    private handleError(error: any): Promise<any> {
        console.log('An error occurred', error);
        return Promise.reject(error.message || error);
    }

    public get_dashboard() : Promise<any> {
        
        return this.http.get(this.service_url + '?facetFilters=tags.dashboard.tag:dashboard', {headers: this.headers})
               .toPromise()
{'fraction_non_alphanumeric': 0.13165365507452093, 'fraction_numerical': 0.0046132008516678496, 'mean_word_length': 2.8990318118948823, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4368436', 'n_tokens_mistral': 837, 'n_tokens_neox': 817, 'n_words': 178}