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 UnlockCard 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: protected $id;
17:
18: /**
19: Unlocks an existing card.
20:
21: *
22: * @param array $headerParameters {
23: *
24: * @var string $Idempotency-Key
25: * }
26: */
27: public function __construct(string $id, array $headerParameters = [])
28: {
29: $this->id = $id;
30: $this->headerParameters = $headerParameters;
31: }
32:
33: public function getMethod(): string
34: {
35: return 'POST';
36: }
37:
38: public function getUri(): string
39: {
40: return str_replace(['{id}'], [$this->id], '/v2/cards/{id}/unlock');
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 getHeadersOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
54: {
55: $optionsResolver = parent::getHeadersOptionsResolver();
56: $optionsResolver->setDefined(['Idempotency-Key']);
57: $optionsResolver->setRequired([]);
58: $optionsResolver->setDefaults([]);
59: $optionsResolver->addAllowedTypes('Idempotency-Key', ['string', 'null']);
60:
61: return $optionsResolver;
62: }
63:
64: /**
65: * {@inheritdoc}
66: *
67: * @return \NxSys\Library\Clients\Brex\API\Team\Model\Card|null
68: */
69: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
70: {
71: $status = $response->getStatusCode();
72: $body = (string) $response->getBody();
73: if (is_null($contentType) === false && (200 === $status && mb_strpos($contentType, 'application/json') !== false)) {
74: return $serializer->deserialize($body, 'NxSys\\Library\\Clients\\Brex\\API\\Team\\Model\\Card', 'json');
75: }
76: }
77:
78: public function getAuthenticationScopes(): array
79: {
80: return ['OAuth2'];
81: }
82: }
83: