1 | <?php declare(strict_types=1); |
||
17 | final class ApiSettings |
||
18 | { |
||
19 | /** |
||
20 | * Travis' Pusher App ID as found on: https://docs.travis-ci.com/api?http#external-apis |
||
21 | * Will automate the retrieval of that key later in the PR. |
||
22 | */ |
||
23 | const PUSHER_KEY = '5df8ac576dcccf4fd076'; |
||
24 | |||
25 | const NAMESPACE = 'ApiClients\\Client\\Travis\\Resource'; |
||
26 | |||
27 | const DEFAULT_TRANSPORT_OPTIONS = [ |
||
28 | FoundationOptions::HYDRATOR_OPTIONS => [ |
||
29 | HydratorOptions::NAMESPACE => self::NAMESPACE, |
||
30 | HydratorOptions::NAMESPACE_DIR => __DIR__ . DIRECTORY_SEPARATOR . 'Resource' . DIRECTORY_SEPARATOR, |
||
31 | ], |
||
32 | FoundationOptions::TRANSPORT_OPTIONS => [ |
||
33 | TransportOptions::HOST => 'api.travis-ci.org', |
||
34 | TransportOptions::HEADERS => [ |
||
35 | 'Accept' => 'application/vnd.travis-ci.2+json', |
||
36 | ], |
||
37 | TransportOptions::MIDDLEWARE => [ |
||
38 | JsonDecodeMiddleware::class, |
||
39 | JsonEncodeMiddleware::class, |
||
40 | UserAgentMiddleware::class, |
||
41 | ], |
||
42 | TransportOptions::DEFAULT_REQUEST_OPTIONS => [ |
||
43 | UserAgentMiddleware::class => [ |
||
44 | UserAgentMiddlewareOptions::STRATEGY => UserAgentStrategies::PACKAGE_VERSION, |
||
45 | UserAgentMiddlewareOptions::PACKAGE => 'api-clients/travis', |
||
46 | ], |
||
47 | ], |
||
48 | ], |
||
49 | ]; |
||
50 | |||
51 | /** |
||
52 | * Get client options based on $token, $suffix, and $suppliedOptions. |
||
53 | * Will add auth middleware when $token isn't empty. |
||
54 | * |
||
55 | * @param string $token |
||
56 | * @param string $suffix |
||
57 | * @param array $suppliedOptions |
||
58 | * @return array |
||
59 | */ |
||
60 | 5 | public static function getOptions( |
|
84 | } |
||
85 |