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 ListSecrets 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: public function getMethod(): string
18: {
19: return 'GET';
20: }
21:
22: public function getUri(): string
23: {
24: return '/v1/webhooks/secrets';
25: }
26:
27: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
28: {
29: return [[], null];
30: }
31:
32: public function getExtraHeaders(): array
33: {
34: return ['Accept' => ['application/json']];
35: }
36:
37: /**
38: * {@inheritdoc}
39: *
40: * @return \NxSys\Library\Clients\Brex\API\Webhooks\Model\WebhookSecret[]|null
41: *
42: * @throws \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsBadRequestException
43: * @throws \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsUnauthorizedException
44: * @throws \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsForbiddenException
45: * @throws \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsInternalServerErrorException
46: */
47: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
48: {
49: $status = $response->getStatusCode();
50: $body = (string) $response->getBody();
51: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
52: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Webhooks\\Model\\WebhookSecret[]', 'json');
53: }
54: if (400 === $status) {
55: throw new \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsBadRequestException($response);
56: }
57: if (401 === $status) {
58: throw new \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsUnauthorizedException($response);
59: }
60: if (403 === $status) {
61: throw new \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsForbiddenException($response);
62: }
63: if (500 === $status) {
64: throw new \NxSys\Library\Clients\Brex\API\Webhooks\Exception\ListSecretsInternalServerErrorException($response);
65: }
66: }
67:
68: public function getAuthenticationScopes(): array
69: {
70: return ['OAuth2'];
71: }
72: }
73: