<commit_before>import {Collection, TemplateJSON} from 'collection-json-base/interfaces';
import {CollectionConfigurationManager, TemplateBase} from 'collection-json-base/models';
import {AngularCollection} from './angular-collection.model';
import {Observable} from 'rxjs/Observable';
import {Http} from '@angular/http';
import {DataJSON, DataStore} from 'collection-json-base';
import {AngularData} from './angular-data.model';

export class AngularTemplate extends TemplateBase {

    private href?: string;

    constructor(template: TemplateJSON, href?: string) {
        super(template);
        this.href = href;
    }

    public submit(): Observable<Collection> {

        if (typeof this.href === 'undefined') {
            throw new Error('Href must be specified to send a POST request using the template');
        }

        this.validationsExtensionCheck();

        const body = { template: this.json() };

        return CollectionConfigurationManager.getHttpService<Http>().post(this.href, body)
            .map((response) => new AngularCollection(response.json().collection));
    }
    public update(): Observable<Collection> {

        if (typeof this.href === 'undefined') {
            throw new Error('Href must be specified to send a request using the template');
        }

        this.validationsExtensionCheck();

        const body = { template: this.json() };

        return CollectionConfigurationManager.getHttpService<Http>().put(this.href, body)
            .map((response) => new AngularCollection(response.json().collection));
    }
<commit_msg>Using new validate method in template<commit_after>import {Collection, TemplateJSON} from 'collection-json-base/interfaces';
import {CollectionConfigurationManager, TemplateBase} from 'collection-json-base/models';
import {AngularCollection} from './angular-collection.model';
import {Observable} from 'rxjs/Observable';
import {Http} from '@angular/http';
import {DataJSON, DataStore} from 'collection-json-base';
import {AngularData} from './angular-data.model';

export class AngularTemplate extends TemplateBase {

    private href?: string;

    constructor(template: TemplateJSON, href?: string) {
        super(template);
        this.href = href;
    }

    public submit(): Observable<Collection> {

        if (typeof this.href === 'undefined') {
            throw new Error('Href must be specified to send a POST request using the template');
        }

        this.validate();

        const body = { template: this.json() };

        return CollectionConfigurationManager.getHttpService<Http>().post(this.href, body)
            .map((response) => new AngularCollection(response.json().collection));
    }
    public update(): Observable<Collection> {

        if (typeof this.href === 'undefined') {
            throw new Error('Href must be specified to send a request using the template');
        }

        this.validate();

        const body = { template: this.json() };

        return CollectionConfigurationManager.getHttpService<Http>().put(this.href, body)
            .map((response) => new AngularCollection(response.json().collection));
    }

{'fraction_non_alphanumeric': 0.12301838934686113, 'fraction_numerical': 0.0, 'mean_word_length': 3.443661971830986, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '7231867', 'n_tokens_mistral': 806, 'n_tokens_neox': 775, 'n_words': 223}