cybercog/youtrack-rest-php

[Concept] Remove Authorization responsibility from YouTrackClient

antonkomarev opened this issue · 1 comments

I've started to overlook an API and I maybe it should be refactored.

Solution №1

// Instantiate YouTrack API Cookie Authenticator
$authenticator = new Rest\Authenticator\CookieAuthenticator($apiUsername, $apiPassword);

// Instantiate YouTrack API Cookie Authorizer
$authorizer = new Rest\Authorizer\CookieAuthorizer($authenticator);

// Instantiate YouTrack API HTTP Client
$httpClient = new Rest\HttpClient\GuzzleHttpClient($psrHttpClient, $authorizer);

// Instantiate YouTrack API Client
$client = new Rest\Client\YouTrackClient($httpClient);