File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ class Client
8989 /**
9090 * @var string
9191 */
92- private $ apiVersion = ' v3 ' ;
92+ private $ apiVersion ;
9393
9494 /**
9595 * The object that sends HTTP messages
@@ -141,8 +141,10 @@ class Client
141141 * Instantiate a new GitHub client.
142142 *
143143 * @param HttpClient|null $httpClient
144+ * @param string|null $apiVersion
145+ * @param string|null $enterpriseUrl
144146 */
145- public function __construct (HttpClient $ httpClient = null )
147+ public function __construct (HttpClient $ httpClient = null , $ apiVersion = null , $ enterpriseUrl = null )
146148 {
147149 $ this ->httpClient = $ httpClient ?: HttpClientDiscovery::find ();
148150 $ this ->messageFactory = MessageFactoryDiscovery::find ();
@@ -156,8 +158,12 @@ public function __construct(HttpClient $httpClient = null)
156158 $ this ->addPlugin (new Plugin \HeaderDefaultsPlugin (array (
157159 'User-Agent ' => 'php-github-api (http://github.com/KnpLabs/php-github-api) ' ,
158160 )));
159- // Add standard headers.
160- $ this ->clearHeaders ();
161+
162+ $ this ->setApiVersion ($ apiVersion ?: 'v3 ' );
163+
164+ if ($ enterpriseUrl ) {
165+ $ this ->setEnterpriseUrl ($ enterpriseUrl );
166+ }
161167 }
162168
163169 /**
You can’t perform that action at this time.
0 commit comments