@param $data
@param $apiKey

@return string
347137
public function getReferralLinkByArrayOfParameters($data, $apiKey = null): string
    {
        if (\is_array($data)) {
            return $this->referralUrl . implode('/', array_filter($data)) . $this->getApiKeyQuery($apiKey);
        }
        return '';
    }
578033
public function sendRequest(ApiKey $apiKey, RestRequest $request)
    {
        $hmac = $this->generateHmac($apiKey->getPrivateKey(), $request->getEndpoint(), array_merge($request->getQueryData(), $request->getPostData()));

        $client = new Client([
            'base_uri' => $request->getHost()
        ]);
        
        $args = [
            'auth' => [$apiKey->getPublicKey(), $hmac],
            'headers' => [
                'Accept' => 'application/json'
            ]
        ];
        
        if ($request->getRequestMethod() === 'POST') {
            $args['form_params'] = $request->getPostData();
        } else {
            $args['query'] = $request->getQueryData();
        }
        
        try {
            $responseRaw = $client->request($request->getRequestMethod(), $request->getEndpoint(), $args);
        } catch (RequestException $e) {
            if (!$e->hasResponse()) {
                throw new Exception('Cannot send REST request.', 0, $e);
            }
            
            $responseRaw = $e->getResponse();
        }
        
        return $this->prepareResponse($responseRaw, $request);
    }
957261
public function delete($params = null, $apiKey = null)
    {
        return self::_delete(get_class(), $params, true);
    }
802377
private function get_dataset($index, $apiindex) {
        if (isset($this->data[$index])) {
            return $this->data[$index];
        }

        $data = array();
        foreach ($this->raw as $k => $v) {
            $pos = strpos($k, $apiindex);
            if ($pos !== 0) {
                continue;
            }

            $data[] = substr($k, strlen($apiindex));
        }

        $this->data[$index] = $data;

        return $data;
    }
1035599
public static function all($params = null, $apiKey = null)
    {
        return self::_all(get_class(), $params, $apiKey);
    }
1284468
public static function build($apiKey)
    {
        self::$apiKey          = $apiKey;
        static::$cachedFactory = new ServiceBuilderLoader();

        return parent::factory(__DIR__.'/Resources/clients.json');
    }
905664
public function getService($apiKey)
    {
        ValidationUtility::ensureStringOrInteger('$apiKey', $apiKey);

        return $this->callServiceOwnerGetApi(
            '\Authlete\Dto\Service::fromJson',
            self::$SERVICE_GET_API_PATH . $apiKey);
    }
929238
public function geocode($data, $fields = [], $key = null)
    {
        if ($key) $this->apiKey = $key;
        return (is_string($data)) ? $this->get($data, $fields) : $this->post($data, $fields);
    }
406934
public function get(string $key): string
    {
        if (!isset($this->data[$key])) {
            $this->data[$key] = $key;
        }

        return $this->data[$key];
    }
879420
public static function byCityName($cityName, $apikey)
    {
        $url = self::WEATHER_API . '/cityname';

        return self::send($url, ['cityname' => $cityName], ["apikey: $apikey"]);
    }
226722
public function getApiKeyWithPrefix($apiKeyIdentifier)
    {
        $prefix = $this->getApiKeyPrefix($apiKeyIdentifier);
        $apiKey = $this->getApiKey($apiKeyIdentifier);

        if ($apiKey === null) {
            return null;
        }

        if ($prefix === null) {
            $keyWithPrefix = $apiKey;
        } else {
            $keyWithPrefix = $prefix . ' ' . $apiKey;
        }

        return $keyWithPrefix;
    }
321961
protected static function _getPluginData(array $data, $key = null)
    {
        if (isset($data[$key])) {
            $data = $data[$key];
        }

        return new Data($data);
    }
794377
private static function _defaultHeaders($apiKey, $clientInfo = null)
    {
        $uaString = 'Stripe/v1 PhpBindings/' . Stripe::VERSION;

        $langVersion = phpversion();
        $uname = php_uname();

        $appInfo = Stripe::getAppInfo();
        $ua = [
            'bindings_version' => Stripe::VERSION,
            'lang' => 'php',
            'lang_version' => $langVersion,
            'publisher' => 'stripe',
            'uname' => $uname,
        ];
        if ($clientInfo) {
            $ua = array_merge($clientInfo, $ua);
        }
        if ($appInfo !== null) {
            $uaString .= ' ' . self::_formatAppInfo($appInfo);
            $ua['application'] = $appInfo;
        }

        $defaultHeaders = [
            'X-Stripe-Client-User-Agent' => json_encode($ua),
            'User-Agent' => $uaString,
            'Authorization' => 'Bearer ' . $apiKey,
        ];
        return $defaultHeaders;
    }
1139775
private function _get( $key, $data, $default ) {
		if ( ! is_array( $data ) || ! array_key_exists( 'value', $data ) ) {
			return $default;
		}
		if ( $this->_expired( $data ) ) {
			$this->_delete( $key );

			return $default;
		}

		return $data['value'];
	}
589321
protected static function logApiKeyAdminEvent(ApiKey $apiKey, $eventName)
    {
        $event             = new ApiKeyAdminEvent;
        $event->api_key_id = $apiKey->id;
        $event->ip_address = request()->ip();
        $event->event      = $eventName;
        $event->save();
    }
1335133
public static function recentWeathers($cityName, $cityCode, $apikey)
    {
        $url = self::WEATHER_API . '/recentweathers';

        return self::send($url, [
            'cityname' => $cityName,
            'cityid' => $cityCode,
        ], ["apikey: $apikey"]);
    }
386532
public static function get_shipping_rates($params = null, $apiKey = null)
    {
        $class = get_class();
        $id = $params['id'];
        return self::_scopedGet($class, $id, $params, $apiKey = null);
    }