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 ListLocations 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 locations.
19:
20: *
21: * @param array $queryParameters {
22: *
23: * @var string $cursor
24: * @var int $limit
25: * @var string $name
26: * }
27: */
28: public function __construct(array $queryParameters = [])
29: {
30: $this->queryParameters = $queryParameters;
31: }
32:
33: public function getMethod(): string
34: {
35: return 'GET';
36: }
37:
38: public function getUri(): string
39: {
40: return '/v2/locations';
41: }
42:
43: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
44: {
45: return [[], null];
46: }
47:
48: public function getExtraHeaders(): array
49: {
50: return ['Accept' => ['application/json']];
51: }
52:
53: protected function getQueryOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
54: {
55: $optionsResolver = parent::getQueryOptionsResolver();
56: $optionsResolver->setDefined(['cursor', 'limit', 'name']);
57: $optionsResolver->setRequired([]);
58: $optionsResolver->setDefaults([]);
59: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
60: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
61: $optionsResolver->addAllowedTypes('name', ['string', 'null']);
62:
63: return $optionsResolver;
64: }
65:
66: /**
67: * {@inheritdoc}
68: *
69: * @return \NxSys\Library\Clients\Brex\API\Team\Model\PageLocationResponse|null
70: *
71: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsBadRequestException
72: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsUnauthorizedException
73: * @throws \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsForbiddenException
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\\Team\\Model\\PageLocationResponse', 'json');
81: }
82: if (400 === $status) {
83: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsBadRequestException($response);
84: }
85: if (401 === $status) {
86: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsUnauthorizedException($response);
87: }
88: if (403 === $status) {
89: throw new \NxSys\Library\Clients\Brex\API\Team\Exception\ListLocationsForbiddenException($response);
90: }
91: }
92:
93: public function getAuthenticationScopes(): array
94: {
95: return ['OAuth2'];
96: }
97: }
98: