protected function apiRequest(Slice $options)
    {
        $allow404 = $options->getData('allow404', false);
        $type     = $options->getData('token_type', 'Basic');
        $method   = $options->getData('method', 'POST');
        $token    = $options->getData('access_token', $this->basic);
        $url      = $options->getData('url', $this->urlToken);
        $params   = $options->getData('params', []);
        $headers  = $options->getData('headers', []);

        // headers
        $headers['Authorization'] = $type . ' ' . $token;

        $client = new Client([
            'debug'       => $this->slice->getData('debug', false),
            'http_errors' => false
        ]);

        $data = [
            'headers'   => $headers,
            'multipart' => $this->multipart($params),
        ];

        $this->response = $client->request(
            Str::upp($method),
            $url,
            $data
        );

        $this->results = null;

        $response = JSON::decode(
            $this->getBody()
        );

        if (JSON::errorNone())
        {
            $this->results = new Slice($response);
        }

        $code = $this->getCode();

        if ($allow404 && $code === 404)
        {
            return $this->getResults();
        }

        if ($code > 199 && $code < 300)
        {
            return $this->getResults();
        }

        throw new Invalid(
            'Error: ' . $this->response->getReasonPhrase(),
            $code
        );
    }
protected function apiRequest(Slice $options)
    {
        $allow404 = $options->getData('allow404', false);
        $type     = $options->getData('token_type', 'Basic');
        $method   = $options->getData('method', 'POST');
        $token    = $options->getData('access_token', $this->basic);
        $url      = $options->getData('url', $this->urlToken);
        $params   = $options->getData('params', []);
        $headers  = $options->getData('headers', []);

        // headers
        $headers['Authorization'] = $type . ' ' . $token;

        $client = new Client([
            'debug'       => $this->slice->getData('debug', false),
            'http_errors' => false
        ]);

        $data = [
            'headers'   => $headers,
            'multipart' => $this->multipart($params),
        ];

        $this->response = $client->request(
            Str::upp($method),
            $url,
            $data
        );

        $this->results = null;

        $response = JSON::decode(
            $this->getBody()
        );

        if (JSON::errorNone())
        {
            $this->results = new Slice($response);
        }

        $code = $this->getCode();

        if ($allow404 && $code === 404)
        {
            return $this->getResults();
        }

        if ($code > 199 && $code < 300)
        {
            return $this->getResults();
        }

        throw new Invalid(
            'Error: ' . $this->response->getReasonPhrase(),
            $code
        );
    }
@param Slice $options

@return Slice|null

@throws Invalid