| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | namespace NxSys\Library\Clients\Brex\API\Payments\Endpoint; |
| 12: | |
| 13: | class ListLinkedAccounts extends \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\BaseEndpoint implements \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\Endpoint |
| 14: | { |
| 15: | use \NxSys\Library\Clients\Brex\API\Payments\Runtime\Client\EndpointTrait; |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | public function __construct(array $queryParameters = []) |
| 28: | { |
| 29: | $this->queryParameters = $queryParameters; |
| 30: | } |
| 31: | |
| 32: | public function getMethod(): string |
| 33: | { |
| 34: | return 'GET'; |
| 35: | } |
| 36: | |
| 37: | public function getUri(): string |
| 38: | { |
| 39: | return '/v1/linked_accounts'; |
| 40: | } |
| 41: | |
| 42: | public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array |
| 43: | { |
| 44: | return [[], null]; |
| 45: | } |
| 46: | |
| 47: | public function getExtraHeaders(): array |
| 48: | { |
| 49: | return ['Accept' => ['application/json']]; |
| 50: | } |
| 51: | |
| 52: | protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver |
| 53: | { |
| 54: | $optionsResolver = parent::getQueryOptionsResolver(); |
| 55: | $optionsResolver->setDefined(['cursor', 'limit']); |
| 56: | $optionsResolver->setRequired([]); |
| 57: | $optionsResolver->setDefaults([]); |
| 58: | $optionsResolver->addAllowedTypes('cursor', ['string', 'null']); |
| 59: | $optionsResolver->addAllowedTypes('limit', ['int', 'null']); |
| 60: | |
| 61: | return $optionsResolver; |
| 62: | } |
| 63: | |
| 64: | |
| 65: | |
| 66: | |
| 67: | |
| 68: | |
| 69: | |
| 70: | |
| 71: | |
| 72: | |
| 73: | protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null) |
| 74: | { |
| 75: | $status = $response->getStatusCode(); |
| 76: | $body = (string) $response->getBody(); |
| 77: | if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) { |
| 78: | return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Payments\\Model\\PageBankConnection', 'json'); |
| 79: | } |
| 80: | if (400 === $status) { |
| 81: | throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsBadRequestException($response); |
| 82: | } |
| 83: | if (401 === $status) { |
| 84: | throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsUnauthorizedException($response); |
| 85: | } |
| 86: | if (403 === $status) { |
| 87: | throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsForbiddenException($response); |
| 88: | } |
| 89: | } |
| 90: | |
| 91: | public function getAuthenticationScopes(): array |
| 92: | { |
| 93: | return ['OAuth2']; |
| 94: | } |
| 95: | } |
| 96: | |