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