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 ListUsers 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: This endpoint lists all users. To find a user id by email, you can filter using the `email` query parameter.
19:
20: *
21: * @param array $queryParameters {
22: *
23: * @var string $cursor
24: * @var int $limit
25: * @var string $email
26: * @var array $expand[]
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/users';
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', 'email', 'expand']);
58: $optionsResolver->setRequired([]);
59: $optionsResolver->setDefaults([]);
60: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
61: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
62: $optionsResolver->addAllowedTypes('email', ['string', 'null']);
63: $optionsResolver->addAllowedTypes('expand', ['array', 'null']);
64:
65: return $optionsResolver;
66: }
67:
68: /**
69: * {@inheritdoc}
70: *
71: * @return \NxSys\Library\Clients\Brex\API\Team\Model\PageUserResponse|null
72: *
73: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersBadRequestException
74: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersUnauthorizedException
75: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersForbiddenException
76: */
77: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
78: {
79: $status = $response->getStatusCode();
80: $body = (string) $response->getBody();
81: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
82: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Team\\Model\\PageUserResponse', 'json');
83: }
84: if (400 === $status) {
85: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersBadRequestException($response);
86: }
87: if (401 === $status) {
88: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersUnauthorizedException($response);
89: }
90: if (403 === $status) {
91: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListUsersForbiddenException($response);
92: }
93: }
94:
95: public function getAuthenticationScopes(): array
96: {
97: return ['OAuth2'];
98: }
99: }
100: