src/Keboola/Writer/GoodData/Client.php
public static function factory($config = [])
    {
        $default = [
            'url' => 'https://syrup.keboola.com/gooddata-writer'
        ];
        $required = ['token'];
        $config = Collection::fromConfig($config, $default, $required);
        $config['request.options'] = [
            'headers' => [
                'X-StorageApi-Token' => $config->get('token')
            ],
            'config' => [
                'curl' => [
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0
                ]

            ]
        ];

        $client = new self($config->get('url'), $config);

        // Attach a service description to the client
        $description = ServiceDescription::factory(__DIR__ . '/service.json');
        $client->setDescription($description);

        $client->setBaseUrl($config->get('url'));

        // Setup exponential backoff
        // 503 retry always, other errors five times
        $backoffPlugin = new BackoffPlugin(new TruncatedBackoffStrategy(
            5,
            new HttpBackoffStrategy(
                null,
                new CurlBackoffStrategy(
                    null,
                    new ExponentialBackoffStrategy()
                )
            )
        ));
        $client->addSubscriber($backoffPlugin);

        return $client;
    }
public static function factory($config = [])
    {
        $default = [
            'url' => 'https://syrup.keboola.com/gooddata-writer'
        ];
        $required = ['token'];
        $config = Collection::fromConfig($config, $default, $required);
        $config['request.options'] = [
            'headers' => [
                'X-StorageApi-Token' => $config->get('token')
            ],
            'config' => [
                'curl' => [
                    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0
                ]

            ]
        ];

        $client = new self($config->get('url'), $config);

        // Attach a service description to the client
        $description = ServiceDescription::factory(__DIR__ . '/service.json');
        $client->setDescription($description);

        $client->setBaseUrl($config->get('url'));

        // Setup exponential backoff
        // 503 retry always, other errors five times
        $backoffPlugin = new BackoffPlugin(new TruncatedBackoffStrategy(
            5,
            new HttpBackoffStrategy(
                null,
                new CurlBackoffStrategy(
                    null,
                    new ExponentialBackoffStrategy()
                )
            )
        ));
        $client->addSubscriber($backoffPlugin);

        return $client;
    }
public static function factory ( $ config = [ ] ) { $ default = [ 'url' => 'https://syrup.keboola.com/gooddata-writer' ] ; $ required = [ 'token' ] ; $ config = Collection :: fromConfig ( $ config , $ default , $ required ) ; $ config [ 'request.options' ] = [ 'headers' => [ 'X-StorageApi-Token' => $ config -> get ( 'token' ) ] , 'config' => [ 'curl' => [ CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0 ] ] ] ; $ client = new self ( $ config -> get ( 'url' ) , $ config ) ; // Attach a service description to the client $ description = ServiceDescription :: factory ( __DIR__ . '/service.json' ) ; $ client -> setDescription ( $ description ) ; $ client -> setBaseUrl ( $ config -> get ( 'url' ) ) ; // Setup exponential backoff // 503 retry always, other errors five times $ backoffPlugin = new BackoffPlugin ( new TruncatedBackoffStrategy ( 5 , new HttpBackoffStrategy ( null , new CurlBackoffStrategy ( null , new ExponentialBackoffStrategy ( ) ) ) ) ) ; $ client -> addSubscriber ( $ backoffPlugin ) ; return $ client ; }
Factory method to create a new Client

The following array keys and values are available options:
- url: Base URL of web service
- token: Storage API token

@param array|Collection $config Configuration data

@return self
Factory method to create a new Client