<commit_before><?php

namespace Mailchimp;

use BadMethodCallException;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Collection;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;

/**
 * @method Collection get($resource, array $options = [])
 * @method Collection head($resource, array $options = [])
 * @method Collection put($resource, array $options = [])
 * @method Collection post($resource, array $options = [])
 * @method Collection patch($resource, array $options = [])
 * @method Collection delete($resource, array $options = [])
 */
class Mailchimp
{
    /**
     * Endpoint for Mailchimp API v3
     *
     * @var string
     */
    private $endpoint = 'https://us1.api.mailchimp.com/3.0/';

    /**
     * @var string
     */
    private $apikey;

    /**
     * @var Client
     */
    private $client;

    /**
     * @var array
     */
    private $allowedMethods = ['get', 'head', 'put', 'post', 'patch', 'delete'];

    /**
     * @var array
     */
    public $options = [];

    /**
     * @param string $apikey
     */
    public function __construct($apikey = '')
    {
        $this->apikey = $apikey;
        $this->client = new Client();

        $this->detectEndpoint($this->apikey);

        $this->options['headers'] = [
            'Authorization' => 'apikey ' . $this->apikey
        ];
    }

    /**
     * @param string $resource
     * @param array $arguments
     * @param string $method
     * @return string
     * @throws Exception
     */
    public function request($resource, $arguments = [], $method = 'GET')
    {
        if ( ! $this->apikey) {
            throw new Exception('Please provide an API key.');<commit_msg>Allow setting guzzle-client options through constructor<commit_after><?php

namespace Mailchimp;

use BadMethodCallException;
use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\ClientException;
use GuzzleHttp\Exception\RequestException;
use Illuminate\Support\Collection;
use InvalidArgumentException;
use Psr\Http\Message\ResponseInterface;

/**
 * @method Collection get($resource, array $options = [])
 * @method Collection head($resource, array $options = [])
 * @method Collection put($resource, array $options = [])
 * @method Collection post($resource, array $options = [])
 * @method Collection patch($resource, array $options = [])
 * @method Collection delete($resource, array $options = [])
 */
class Mailchimp
{

    /**
     * Endpoint for Mailchimp API v3
     *
     * @var string
     */
    private $endpoint = 'https://us1.api.mailchimp.com/3.0/';

    /**
     * @var string
     */
    private $apikey;

    /**
     * @var Client
     */
    private $client;

    /**
     * @var array
     */
    private $allowedMethods = ['get', 'head', 'put', 'post', 'patch', 'delete'];

    /**
     * @var array
     */
    public $options = [];

    /**
     * @param string $apikey
     * @param array $clientOptions
     */
    public function __construct($apikey = '', $clientOptions = [])
    {
        $this->apikey = $apikey;
        $this->client = new Client($clientOptions);

        $this->detectEndpoint($this->apikey);

        $this->options['headers'] = [
            'Authorization' => 'apikey ' . $this->apikey
        ];
    }

    /**
     * @param string $resource
     * @param array $arguments
     * @param string $method
     * @return string
     * @throws Exception
     */
    public function request($resource, $arguments = [], $method = 'GET')
    {
        if ( ! $this->apikey) {
            throw new Exception('Please provide an API key.');
{'fraction_non_alphanumeric': 0.15275890187550964, 'fraction_numerical': 0.0021745039412883935, 'mean_word_length': 2.622047244094488, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 19, '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': '1953652', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1064, 'n_words': 262}