<commit_before><?php

namespace MergadoClient;

use League\OAuth2\Client\Token\AccessToken;

class ApiClient
{

	private $urlBuilder;
	private $http;

	public function __construct($token = null, $mode = null) {

		$this->urlBuilder = new UrlBuilder($mode);
		$this->http = new HttpClient($token);
	}

	public function setToken($token) {
		$this->http->setToken($token);
	}

	/**
	 * @param $name
	 * @return Api
	 */
	public function __get($name) {
		$this->urlBuilder->appendFromProperty($name);
		return $this;
	}

	/**
	 * @param $method
	 * @param $args
	 * @return Api
	 */
	public function __call($method, $args) {
		$this->urlBuilder->appendFromMethod($method, $args);
		return $this;

	}

	public function setParams(array $params){

	}

	/**
	 * Get resource
	 * @return string
	 */
	public function get() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'GET');
	}

	public function post($data = []) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'POST', $data);
	}

	public function put($data = null) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'PATCH', $data);
	}

	public function delete() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'DELETE');
	}

	public function limit($number) {
		$this->urlBuilder->addQueryParam('limit', $number);
		return $this;
	}

	public function offset($number) {
		$this->urlBuilder->addQueryParam('offset', $number);
		return $this;
	}

	public function fields(array $fields) {
		$arr = $fields;<commit_msg>Added async methods to ApiClient<commit_after><?php

namespace MergadoClient;

use League\OAuth2\Client\Token\AccessToken;

class ApiClient
{

	private $urlBuilder;
	private $http;

	public function __construct($token = null, $mode = null) {

		$this->urlBuilder = new UrlBuilder($mode);
		$this->http = new HttpClient($token);
	}

	public function setToken($token) {
		$this->http->setToken($token);
	}

	/**
	 * @param $name
	 * @return Api
	 */
	public function __get($name) {
		$this->urlBuilder->appendFromProperty($name);
		return $this;
	}

	/**
	 * @param $method
	 * @param $args
	 * @return Api
	 */
	public function __call($method, $args) {
		$this->urlBuilder->appendFromMethod($method, $args);
		return $this;

	}

	public function setParams(array $params){

	}

	/**
	 * Get resource
	 * @return string
	 */
	public function get() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'GET');
	}

	public function post($data = []) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'POST', $data);
	}

	public function put($data = null) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'PATCH', $data);
	}

	public function delete() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->request($builtUrl, 'DELETE');
	}

	public function getAsync() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->requestAsync($builtUrl, 'GET');
	}

	public function postAsync($data = []) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->requestAsync($builtUrl, 'POST', $data);
	}

	public function putAsync($data = null) {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->requestAsync($builtUrl, 'PATCH', $data);
	}

	public function deleteAsync() {
		$builtUrl = $this->urlBuilder->buildUrl();
		$this->urlBuilder->resetUrl();
		return $this->http->requestAsync($builtUrl, 'DELETE');
	}

	public function limit($number) {
		$this->urlBuilder->addQueryParam('limit', $number);
		return $this;
	}

	public function offset($number) {
		$this->urlBuilder->addQueryParam('offset', $number);
		return $this;
	}

	public function fields(array $fields) {
		$arr = $fields;
{'fraction_non_alphanumeric': 0.1854743316773125, 'fraction_numerical': 0.0004731488052992666, 'mean_word_length': 4.48378728923476, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 99, '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': '2740028', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1396, 'n_words': 278}