<commit_before>import axios from 'axios';

class WhiteLabelAPI {
    constructor(clientId) {
        // Define API endpoints
        this.BASE_URL = 'https://beta.whitelabel.cool/api';
        this.COLLECTIONS = '/collections/';
        this.MIXTAPES = '/mixtapes/';
        this.TRACKS = '/tracks/';
        this.RECORD = '/events/plays/';
        this.CLIENT_ID = clientId;

        if (!clientId || clientId === '') {
            throw new Error('You must provide a valid client id');
        }

        this.request = axios.create({
            baseURL: this.BASE_URL,
            timeout: 2000,
            headers: {
                'Accept': 'application/json; version=1.0',
                'Client': clientId,
            },
        });
    }

    normalizePath(path) {
        return path.split('//').join('/');
    }

    // ES7 async and await 🔥
    async getFetch(path, options = {
        page: 1,
        all: false,
        results: false,
    }) {
        let results = [];
        const config = {
            params: {
                page: options.page,
            },
        };

        // Throws an error if the request was unsuccessful
        // The error can be caught in the .catch of a Promise
        const checkSuccess = function(response) {
            if (response.status !== 200) {
                throw new Error('Status code was ' + response.status);<commit_msg>increase timeout from 2 to 10 seconds<commit_after>import axios from 'axios';

class WhiteLabelAPI {
    constructor(clientId) {
        // Define API endpoints
        this.BASE_URL = 'https://beta.whitelabel.cool/api';
        this.COLLECTIONS = '/collections/';
        this.MIXTAPES = '/mixtapes/';
        this.TRACKS = '/tracks/';
        this.RECORD = '/events/plays/';
        this.CLIENT_ID = clientId;

        if (!clientId || clientId === '') {
            throw new Error('You must provide a valid client id');
        }

        this.request = axios.create({
            baseURL: this.BASE_URL,
            timeout: 10000,
            headers: {
                'Accept': 'application/json; version=1.0',
                'Client': clientId,
            },
        });
    }

    normalizePath(path) {
        return path.split('//').join('/');
    }

    // ES7 async and await 🔥
    async getFetch(path, options = {
        page: 1,
        all: false,
        results: false,
    }) {
        let results = [];
        const config = {
            params: {
                page: options.page,
            },
        };

        // Throws an error if the request was unsuccessful
        // The error can be caught in the .catch of a Promise
        const checkSuccess = function(response) {
            if (response.status !== 200) {
                throw new Error('Status code was ' + response.status);
{'fraction_non_alphanumeric': 0.12495562655307065, 'fraction_numerical': 0.009229676961306355, 'mean_word_length': 1.568824065633546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2428097', 'n_tokens_mistral': 819, 'n_tokens_neox': 769, 'n_words': 207}