cybercog / youtrack-rest-php Goto Github PK
View Code? Open in Web Editor NEWJetBrains YouTrack REST API PHP Client
Home Page: https://komarev.com/sources/php-youtrack-rest
License: MIT License
JetBrains YouTrack REST API PHP Client
Home Page: https://komarev.com/sources/php-youtrack-rest
License: MIT License
*Exception
postfix on each exception. Make them more verbose.Cog\Contracts\YouTrack\Rest\Client\Exceptions\ClientException
should extend RuntimeException
?Authenticator
shouldn't append headers to Client request. Authorizer
should do it.
This change will lead us to extend Authenticator
contract by adding token
method.
In example for time tracking of issue we refer to the next request
GET /api/issues/{issueID}/timeTracking?{fields}
For GET request we need send params in 'query' key for Guzzle Http, but in function buildOptions we can see that it is impossible to do.
In result we got wrong request
The solution is to change the $defaultOptions parameter
$defaultOptions = [ 'headers' => $this->buildHeaders() ];
and add additional action for value $options
User-Agent
headers should be more verbose: CLIENT/VERSION HTTP_CLIENT/VERSION PHP/VERSION
.$http = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com',
]);
$client = new \Cog\YouTrack\Services\YouTrackClient($http, [
'driver' => \Cog\YouTrack\Authenticators\TokenAuthenticator::class,
'token' => 'YOUTRACK_API_TOKEN',
]);
$http = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com',
]);
$client = new \Cog\YouTrack\Services\YouTrackClient($http, [
'driver' => \Cog\YouTrack\Authenticators\CookieAuthenticator::class,
'username' => 'YOUTRACK_USERNAME',
'password' => 'YOUTRACK_PASSWORD',
]);
$this->app->bind(YouTrackClientContract::class, function () {
$config = $this->app->make('config');
$http = new Client([
'base_uri' => $config->get('youtrack.base_uri'),
]);
$options = $config->get('youtrack.authenticators.' . $config->get('youtrack.authenticator'));
return new YouTrackClient($http, $options);
});
YouTrackClient
.buildHeaders
never accept $options
variable, remove param or make it usable.request
method $options
revert back to $formData
and add new $options
param which will overwrite HTTP client options.Related to cybercog/laravel-youtrack-sdk#10
I've started to overlook an API and I maybe it should be refactored.
authenticate
method from Authorizer contract (not it's responsibility).New API proposals will be described below.
OAuthAuthorizer
to allow OAuth 2.0 authorization and to have all default available methods implemented.At the moment this module holds us from upgrading to Guzzle 7. Any plans to support it please?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.