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\Team\Endpoint;
12:
13: class ListCardsByUserId extends \NxSys\Library\Clients\Brex\API\Team\Runtime\Client\BaseEndpoint implements \NxSys\Library\Clients\Brex\API\Team\Runtime\Client\Endpoint
14: {
15: use \NxSys\Library\Clients\Brex\API\Team\Runtime\Client\EndpointTrait;
16:
17: /**
18: Lists all cards by a `user_id`.
19: Only cards with `limit_type = CARD` have `spend_controls`
20:
21: *
22: * @param array $queryParameters {
23: *
24: * @var string $user_id
25: * @var string $cursor
26: * @var int $limit
27: * }
28: */
29: public function __construct(array $queryParameters = [])
30: {
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 '/v2/cards';
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(['user_id', 'cursor', 'limit']);
58: $optionsResolver->setRequired([]);
59: $optionsResolver->setDefaults([]);
60: $optionsResolver->addAllowedTypes('user_id', ['string', 'null']);
61: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
62: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
63:
64: return $optionsResolver;
65: }
66:
67: /**
68: * {@inheritdoc}
69: *
70: * @return \NxSys\Library\Clients\Brex\API\Team\Model\PageCard|null
71: */
72: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
73: {
74: $status = $response->getStatusCode();
75: $body = (string) $response->getBody();
76: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
77: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Team\\Model\\PageCard', 'json');
78: }
79: }
80:
81: public function getAuthenticationScopes(): array
82: {
83: return ['OAuth2'];
84: }
85: }
86: