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\Transactions\Endpoint;
12:
13: class ListCashStatements extends \NxSys\Library\Clients\Brex\API\Transactions\Runtime\Client\BaseEndpoint implements \NxSys\Library\Clients\Brex\API\Transactions\Runtime\Client\Endpoint
14: {
15: use \NxSys\Library\Clients\Brex\API\Transactions\Runtime\Client\EndpointTrait;
16: protected $id;
17:
18: /**
19: This endpoint lists all finalized statements for the cash account by ID.
20:
21: *
22: * @param array $queryParameters {
23: *
24: * @var string $cursor
25: * @var int $limit
26: * }
27: */
28: public function __construct(string $id, array $queryParameters = [])
29: {
30: $this->id = $id;
31: $this->queryParameters = $queryParameters;
32: }
33:
34: public function getMethod(): string
35: {
36: return 'GET';
37: }
38:
39: public function getUri(): string
40: {
41: return str_replace(['{id}'], [$this->id], '/v2/accounts/cash/{id}/statements');
42: }
43:
44: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
45: {
46: return [[], null];
47: }
48:
49: public function getExtraHeaders(): array
50: {
51: return ['Accept' => ['application/json']];
52: }
53:
54: protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
55: {
56: $optionsResolver = parent::getQueryOptionsResolver();
57: $optionsResolver->setDefined(['cursor', 'limit']);
58: $optionsResolver->setRequired([]);
59: $optionsResolver->setDefaults([]);
60: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
61: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
62:
63: return $optionsResolver;
64: }
65:
66: /**
67: * {@inheritdoc}
68: *
69: * @return \NxSys\Library\Clients\Brex\API\Transactions\Model\PageStatement|null
70: *
71: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsBadRequestException
72: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsUnauthorizedException
73: * @throws \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsForbiddenException
74: */
75: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
76: {
77: $status = $response->getStatusCode();
78: $body = (string) $response->getBody();
79: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
80: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Transactions\\Model\\PageStatement', 'json');
81: }
82: if (400 === $status) {
83: throw new \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsBadRequestException($response);
84: }
85: if (401 === $status) {
86: throw new \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsUnauthorizedException($response);
87: }
88: if (403 === $status) {
89: throw new \NxSys\Library\Clients\Brex\API\Transactions\Exception\ListCashStatementsForbiddenException($response);
90: }
91: }
92:
93: public function getAuthenticationScopes(): array
94: {
95: return ['OAuth2'];
96: }
97: }
98: