<commit_before>import nodeFetch from 'node-fetch'
import {checkStatus, parseJSON} from './utils'
import {getHost} from './settings'

export default class QueryBuilder {
  constructor() {
    this.baseUrl = `https://${getHost()}`
  }

  fetch(url, options) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        'X-API-KEY': this.instance.token
      },
      ...options
    })
      .then(checkStatus)
      .then(parseJSON)
  }

  localFetch(url, token, options) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        'X-API-KEY': this.instance.token
      },
      ...options
    })
      .then(checkStatus)
  }

  nonInstanceFetch(url, options, headers) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        ...headers
      },
      ...options
    })
      .then(checkStatus)
      .then(parseJSON)
  }

  get query() {
    return this._query || {}
  }

  withQuery(query) {<commit_msg>fix(fetch): removing wrong argument<commit_after>import nodeFetch from 'node-fetch'
import {checkStatus, parseJSON} from './utils'
import {getHost} from './settings'

export default class QueryBuilder {
  constructor() {
    this.baseUrl = `https://${getHost()}`
  }

  fetch(url, options) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        'X-API-KEY': this.instance.token
      },
      ...options
    })
      .then(checkStatus)
      .then(parseJSON)
  }

  localFetch(url, options) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        'X-API-KEY': this.instance.token
      },
      ...options
    })
      .then(checkStatus)
  }

  nonInstanceFetch(url, options, headers) {
    return nodeFetch(url, {
      headers: {
        'Content-Type': 'application/json',
        ...headers
      },
      ...options
    })
      .then(checkStatus)
      .then(parseJSON)
  }

  get query() {
    return this._query || {}
  }

  withQuery(query) {
{'fraction_non_alphanumeric': 0.15332362930616206, 'fraction_numerical': 0.0, 'mean_word_length': 2.216848673946958, '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': '6303821', 'n_tokens_mistral': 653, 'n_tokens_neox': 644, 'n_words': 124}