Skip to content

Commit 162a89f

Browse files
committed
ENHANCE: add SyliusClientBuilderInterface
1 parent e9b08a5 commit 162a89f

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

src/SyliusClientBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
* @copyright 2017 Akeneo SAS (http://www.akeneo.com)
6767
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
6868
*/
69-
class SyliusClientBuilder
69+
class SyliusClientBuilder implements SyliusClientBuilderInterface
7070
{
7171
/** @var string */
7272
protected $baseUri;
@@ -200,7 +200,7 @@ public function buildAuthenticatedByHeader(array $xAuthToken): SyliusClientInter
200200
return $this->buildAuthenticatedClient($authentication);
201201
}
202202

203-
protected function buildAuthenticatedClient(Authentication $authentication): SyliusClientInterface
203+
private function buildAuthenticatedClient(Authentication $authentication): SyliusClientInterface
204204
{
205205
[$resourceClient, $pageFactory, $cursorFactory, $fileSystem] = $this->setUp($authentication);
206206

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Diglin GmbH - Switzerland.
4+
*
5+
* @author Sylvain Rayé <support at diglin.com>
6+
* @category FWG OroCRM
7+
* @copyright 2020 - Diglin (https://www.diglin.com)
8+
*/
9+
10+
namespace Diglin\Sylius\ApiClient;
11+
12+
use Http\Client\HttpClient as Client;
13+
use Http\Message\RequestFactory;
14+
use Http\Message\StreamFactory;
15+
16+
interface SyliusClientBuilderInterface
17+
{
18+
public function setBaseUri(string $baseUri);
19+
20+
public function setDefaultHeaders(array $headers);
21+
22+
public function setHttpClient(Client $httpClient);
23+
24+
public function setRequestFactory(RequestFactory $requestFactory);
25+
26+
public function setStreamFactory(StreamFactory $streamFactory);
27+
28+
public function buildAuthenticatedByPassword(
29+
string $clientId,
30+
string $secret,
31+
string $username,
32+
string $password
33+
): SyliusClientInterface;
34+
35+
public function buildAuthenticatedByToken(
36+
string $clientId,
37+
string $secret,
38+
string $token,
39+
string $refreshToken
40+
): SyliusClientInterface;
41+
42+
public function buildAuthenticatedByHeader(array $xAuthToken): SyliusClientInterface;
43+
}

0 commit comments

Comments
 (0)