Skip to content

Commit

Permalink
Use API client next stable version
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkomarev committed May 22, 2017
1 parent e73b2ca commit 9512b6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 40 deletions.
42 changes: 3 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ YouTrack PHP Software Development Kit provides set of tools to interact with [Je
- [Frameworks support](#frameworks-support)
- [Installation](#installation)
- [Usage](#usage)
- [Initialize API client](#initialize-api-client)
- [Repositories methods](#repositories-methods)
- [API client](#api-client)
- [Change log](#change-log)
- [Contributing](#contributing)
- [Testing](#testing)
Expand Down Expand Up @@ -90,44 +89,9 @@ require_once '/path/to/your-project/vendor/autoload.php';

## Usage

### Initialize API client
### API client

#### Token authorization

Starting with YouTrack 2017.1 release [authorization based on permanent tokens](https://www.jetbrains.com/help/youtrack/standalone/2017.2/Manage-Permanent-Token.html) is recommended as the main approach for the authorization in your REST API calls.

```php
// Instantiate HTTP Client
$psrHttpClient = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com',
]);

// Instantiate YouTrack API Token Authorizer
$authorizer = new \Cog\YouTrack\Rest\Authorizer\TokenAuthorizer([
'token' => 'YOUTRACK_API_TOKEN',
]);

// Instantiate YouTrack API Client
$client = new \Cog\YouTrack\Rest\YouTrackClient($psrHttpClient, $authorizer);
```

#### Cookie authorization

```php
// Instantiate HTTP Client
$psrHttpClient = new \GuzzleHttp\Client([
'base_uri' => 'https://example.com',
]);

// Instantiate YouTrack API Cookie Authorizer
$authorizer = new \Cog\YouTrack\Rest\Authorizer\CookieAuthorizer([
'username' => 'YOUTRACK_USERNAME',
'password' => 'YOUTRACK_PASSWORD',
]);

// Instantiate YouTrack API Client
$client = new \Cog\YouTrack\Rest\YouTrackClient($psrHttpClient, $authorizer);
```
[YouTrack REST API PHP Client package documentation](https://github.com/cybercog/youtrack-rest-php/tree/3.0.0#usage).

## Change log

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"docs": "https://github.com/cybercog/youtrack-php-sdk/wiki"
},
"require": {
"cybercog/youtrack-rest-php": "^2.0",
"cybercog/youtrack-rest-php": "^3.0",
"php": "^7.1"
},
"require-dev": {
Expand Down

0 comments on commit 9512b6b

Please sign in to comment.