| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 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: | |
| 20: | |
| 21: | |
| 22: | |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 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: | |
| 69: | |
| 70: | |
| 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: | |