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 ListTransfers 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 existing transfers for an account.
19:
20: Currently, the API can only return transfers for the following payment rails:
21: - ACH
22: - DOMESTIC_WIRE
23: - CHEQUE
24: - INTERNATIONAL_WIRE
25:
26: *
27: * @param array $queryParameters {
28: *
29: * @var string $cursor
30: * @var int $limit
31: * }
32: */
33: public function __construct(array $queryParameters = [])
34: {
35: $this->queryParameters = $queryParameters;
36: }
37:
38: public function getMethod(): string
39: {
40: return 'GET';
41: }
42:
43: public function getUri(): string
44: {
45: return '/v1/transfers';
46: }
47:
48: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
49: {
50: return [[], null];
51: }
52:
53: public function getExtraHeaders(): array
54: {
55: return ['Accept' => ['application/json']];
56: }
57:
58: protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
59: {
60: $optionsResolver = parent::getQueryOptionsResolver();
61: $optionsResolver->setDefined(['cursor', 'limit']);
62: $optionsResolver->setRequired([]);
63: $optionsResolver->setDefaults([]);
64: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
65: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
66:
67: return $optionsResolver;
68: }
69:
70: /**
71: * {@inheritdoc}
72: *
73: * @return \NxSys\Library\Clients\Brex\API\Payments\Model\PageTransfer|null
74: *
75: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersBadRequestException
76: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersUnauthorizedException
77: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersForbiddenException
78: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersInternalServerErrorException
79: */
80: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
81: {
82: $status = $response->getStatusCode();
83: $body = (string) $response->getBody();
84: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
85: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Payments\\Model\\PageTransfer', 'json');
86: }
87: if (400 === $status) {
88: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersBadRequestException($response);
89: }
90: if (401 === $status) {
91: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersUnauthorizedException($response);
92: }
93: if (403 === $status) {
94: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersForbiddenException($response);
95: }
96: if (500 === $status) {
97: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListTransfersInternalServerErrorException($response);
98: }
99: }
100:
101: public function getAuthenticationScopes(): array
102: {
103: return ['OAuth2'];
104: }
105: }
106: