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 EmailCardNumber 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: Creates a secure email to send card number, CVV, and expiration date of a card by ID to the specified email.
20:
21: This endpoint is currently gated. If you would like to request access, please reach out to
22: [email protected]
23:
24: *
25: * @param array $headerParameters {
26: *
27: * @var string $Idempotency-Key
28: * }
29: */
30: public function __construct(string $id, \NxSys\Library\Clients\Brex\API\Team\Model\SecureEmailForCardDetailsRequest $requestBody, array $headerParameters = [])
31: {
32: $this->id = $id;
33: $this->body = $requestBody;
34: $this->headerParameters = $headerParameters;
35: }
36:
37: public function getMethod(): string
38: {
39: return 'POST';
40: }
41:
42: public function getUri(): string
43: {
44: return str_replace(['{id}'], [$this->id], '/v2/cards/{id}/secure_email');
45: }
46:
47: public function getBody(\Symfony\Component\Serializer\SerializerInterface $serializer, $streamFactory = null): array
48: {
49: if ($this->body instanceof \NxSys\Library\Clients\Brex\API\Team\Model\SecureEmailForCardDetailsRequest) {
50: return [['Content-Type' => ['application/json']], $serializer->serialize($this->body, 'json')];
51: }
52:
53: return [[], null];
54: }
55:
56: protected function getHeadersOptionsResolver(): \Symfony\Component\OptionsResolver\OptionsResolver
57: {
58: $optionsResolver = parent::getHeadersOptionsResolver();
59: $optionsResolver->setDefined(['Idempotency-Key']);
60: $optionsResolver->setRequired(['Idempotency-Key']);
61: $optionsResolver->setDefaults([]);
62: $optionsResolver->addAllowedTypes('Idempotency-Key', ['string']);
63:
64: return $optionsResolver;
65: }
66:
67: /**
68: * {@inheritdoc}
69: *
70: * @return null
71: */
72: protected function transformResponseBody(\Psr\Http\Message\ResponseInterface $response, \Symfony\Component\Serializer\SerializerInterface $serializer, ?string $contentType = null)
73: {
74: $status = $response->getStatusCode();
75: $body = (string) $response->getBody();
76: if (200 === $status) {
77: return null;
78: }
79: }
80:
81: public function getAuthenticationScopes(): array
82: {
83: return ['OAuth2'];
84: }
85: }
86: