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 ListVendors 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 all existing vendors for an account.
19: Takes an optional parameter to match by vendor name.
20:
21: *
22: * @param array $queryParameters {
23: *
24: * @var string $cursor
25: * @var int $limit
26: * @var string $name
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 '/v1/vendors';
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', 'name']);
58: $optionsResolver->setRequired([]);
59: $optionsResolver->setDefaults([]);
60: $optionsResolver->addAllowedTypes('cursor', ['string', 'null']);
61: $optionsResolver->addAllowedTypes('limit', ['int', 'null']);
62: $optionsResolver->addAllowedTypes('name', ['string', 'null']);
63:
64: return $optionsResolver;
65: }
66:
67: /**
68: * {@inheritdoc}
69: *
70: * @return \NxSys\Library\Clients\Brex\API\Payments\Model\PageVendorResponse|null
71: *
72: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsBadRequestException
73: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsUnauthorizedException
74: * @throws \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsForbiddenException
75: */
76: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
77: {
78: $status = $response->getStatusCode();
79: $body = (string) $response->getBody();
80: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
81: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Payments\\Model\\PageVendorResponse', 'json');
82: }
83: if (400 === $status) {
84: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsBadRequestException($response);
85: }
86: if (401 === $status) {
87: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsUnauthorizedException($response);
88: }
89: if (403 === $status) {
90: throw new \NxSys\Library\Clients\Brex\API\Payments\Exception\ListVendorsForbiddenException($response);
91: }
92: }
93:
94: public function getAuthenticationScopes(): array
95: {
96: return ['OAuth2'];
97: }
98: }
99: