1: <?php
2:
3: declare(strict_types=1);
4:
5: /*
6: * This file has been auto generated by Jane,
7: *
8: * Do no edit it directly.
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: This endpoint lists all bank connections that are eligible to make ACH transfers to Brex cash account
19:
20: *
21: * @param array $queryParameters {
22: *
23: * @var string $cursor
24: * @var int $limit
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: * {@inheritdoc}
66: *
67: * @return \NxSys\Library\Clients\Brex\API\Payments\Model\PageBankConnection|null
68: *
69: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsBadRequestException
70: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsUnauthorizedException
71: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListLinkedAccountsForbiddenException
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: