Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/Github/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class Client
/**
* @var string
*/
private $apiVersion = 'v3';
private $apiVersion;

/**
* The object that sends HTTP messages
Expand Down Expand Up @@ -141,8 +141,10 @@ class Client
* Instantiate a new GitHub client.
*
* @param HttpClient|null $httpClient
* @param string|null $apiVersion
* @param string|null $enterpriseUrl
*/
public function __construct(HttpClient $httpClient = null)
public function __construct(HttpClient $httpClient = null, $apiVersion = null, $enterpriseUrl = null)
{
$this->httpClient = $httpClient ?: HttpClientDiscovery::find();
$this->messageFactory = MessageFactoryDiscovery::find();
Expand All @@ -156,8 +158,12 @@ public function __construct(HttpClient $httpClient = null)
$this->addPlugin(new Plugin\HeaderDefaultsPlugin(array(
'User-Agent' => 'php-github-api (http://github.com/KnpLabs/php-github-api)',
)));
// Add standard headers.
$this->clearHeaders();

$this->setApiVersion($apiVersion ?: 'v3');

if ($enterpriseUrl) {
$this->setEnterpriseUrl($enterpriseUrl);
}
}

/**
Expand Down